def wait_till_pulp_tasks_finish(connection): ''' wait until there are no running Pulp tasks ''' # will be using pulp-admin, which requires you to log in to it # if the Pulp user cert has expired, delete it first of all; # if the Pulp user cert doesn't exist, use the one from rhui-manager # but create the .pulp directory (with the right perms) if it doesn't exist try: if Util.cert_expired(connection, "~/.pulp/user-cert.pem"): Expect.expect_retval(connection, "rm -f ~/.pulp/user-cert.pem") except OSError: pass rhua = ConMgr.get_rhua_hostname() Expect.expect_retval( connection, "if ! [ -e ~/.pulp/user-cert.pem ]; then " + "mkdir -p -m 700 ~/.pulp; " + "ln -s ~/.rhui/%s/user.crt ~/.pulp/user-cert.pem; " % rhua + "touch /tmp/pulploginhack; " + "fi") while connection.recv_exit_status( "pulp-admin tasks list | grep -q '^No tasks found'"): time.sleep(15) Expect.expect_retval( connection, "if [ -f /tmp/pulploginhack ]; then " + "rm -f ~/.pulp/user-cert.pem /tmp/pulploginhack; " + "fi")
def change_user_password(connection, password='******'): ''' Change the password of rhui-manager user ''' rhua = ConMgr.get_rhua_hostname() Expect.enter(connection, "p") Expect.expect(connection, "Username:"******"New Password:"******"Re-enter Password:"******"Password successfully updated") # this action is supposed to log the admin out and thus delete the user cert Expect.expect_retval(connection, "test -f /root/.rhui/%s/user.crt" % rhua, 1)
import csv import logging from os.path import basename import subprocess import nose from rhui3_tests_lib.conmgr import ConMgr from rhui3_tests_lib.rhuimanager import RHUIManager from rhui3_tests_lib.rhuimanager_instance import RHUIManagerInstance logging.basicConfig(level=logging.DEBUG) HOSTNAMES = { "RHUA": ConMgr.get_rhua_hostname(), "CDS": ConMgr.get_cds_hostnames(), "HAProxy": ConMgr.get_haproxy_hostnames() } PORTS = {"puppet": 8140, "https": 443, "crane": 5000} PROTOCOL_TEST_CMD = "echo | openssl s_client -%s -connect %s:%s; echo $?" # these are in fact the s_client options for protocols, just without the dash PROTOCOLS = {"good": ["tls1_2"], "bad": ["ssl3", "tls1", "tls1_1"]} RESULTS = { "good": "Secure Renegotiation IS supported", "bad": "Secure Renegotiation IS NOT supported" } # connections to the RHUA and the HAProxy nodes RHUA = ConMgr.connect() HAPROXIES = [ConMgr.connect(host) for host in HOSTNAMES["HAProxy"]]