def upload_content(connection, repolist, path): ''' upload content to a custom repository ''' # Temporarily quit rhui-manager and check whether "path" is a file or a directory. # If it is a directory, get a list of *.rpm files in it. Expect.enter(connection, 'q') Expect.enter(connection, "stat -c %F " + path) path_type = Expect.expect_list( connection, [(re.compile(".*regular file.*", re.DOTALL), 1), (re.compile(".*directory.*", re.DOTALL), 2)]) if path_type == 1: content = [basename(path)] elif path_type == 2: Expect.enter(connection, "echo " + path + "/*.rpm") output = Expect.match(connection, re.compile("(.*)", re.DOTALL))[0] rpm_files = output.splitlines()[1] content = [] for rpm_file in rpm_files.split(): content.append(basename(rpm_file)) else: # This should not happen. Getting here means that "path" is neither a file nor a directory. # Anyway, going on with no content, leaving it up to proceed_with_check() to handle this situation. content = [] # Start rhui-manager again and continue. RHUIManager.initial_run(connection) RHUIManager.screen(connection, "repo") Expect.enter(connection, "u") RHUIManager.select(connection, repolist) Expect.expect(connection, "will be uploaded:") Expect.enter(connection, path) RHUIManager.proceed_with_check(connection, "The following RPMs will be uploaded:", content) RHUIManager.quit(connection)
def test_01_login_add_cds_hap(): """log in to RHUI, add CDS and HAProxy nodes""" RHUIManager.initial_run(RHUA) for cds in HOSTNAMES["CDS"]: RHUIManagerInstance.add_instance(RHUA, "cds", cds) for haproxy in HOSTNAMES["HAProxy"]: RHUIManagerInstance.add_instance(RHUA, "loadbalancers", haproxy)
def upload_content(connection, repolist, path): ''' upload content to a custom repository ''' # Temporarily quit rhui-manager and check whether "path" is a file or a directory. # If it is a directory, get a list of *.rpm files in it. Expect.enter(connection, 'q') Expect.enter(connection, "stat -c %F " + path) path_type = Expect.expect_list(connection, [(re.compile(".*regular file.*", re.DOTALL), 1), (re.compile(".*directory.*", re.DOTALL), 2)]) if path_type == 1: content = [basename(path)] elif path_type == 2: Expect.enter(connection, "echo " + path + "/*.rpm") output = Expect.match(connection, re.compile("(.*)", re.DOTALL))[0] rpm_files = output.splitlines()[1] content = [] for rpm_file in rpm_files.split(): content.append(basename(rpm_file)) else: # This should not happen. Getting here means that "path" is neither a file nor a directory. # Anyway, going on with no content, leaving it up to proceed_with_check() to handle this situation. content = [] # Start rhui-manager again and continue. RHUIManager.initial_run(connection) RHUIManager.screen(connection, "repo") Expect.enter(connection, "u") RHUIManager.select(connection, repolist) Expect.expect(connection, "will be uploaded:") Expect.enter(connection, path) RHUIManager.proceed_with_check(connection, "The following RPMs will be uploaded:", content) Expect.expect(connection, "rhui \(" + "repo" + "\) =>")
def test_01_setup(self): '''log in to rhui-manager, upload RH cert, add a repo to sync ''' RHUIManager.initial_run(RHUA) entlist = RHUIManagerEntitlements.upload_rh_certificate(RHUA) nose.tools.assert_not_equal(len(entlist), 0) RHUIManagerRepo.add_rh_repo_by_repo(RHUA, [ Util.format_repo(self.yum_repo_name, self.yum_repo_version, self.yum_repo_kind) ])
def test_00_rhui_init(): ''' add a CDS and run rhui-subscription-sync to ensure their log files exist ''' # use initial_run first to ensure we're logged in to rhui-manager RHUIManager.initial_run(CONNECTION_RHUA) RHUIManagerInstance.add_instance(CONNECTION_RHUA, "cds") # can't use expect_retval as the exit code can be 0 or 1 (sync is configured or unconfigured) Expect.ping_pong(CONNECTION_RHUA, "rhui-subscription-sync ; echo ACK", "ACK")
def test_01_setup(): """log in to RHUI, ensure CDS & HAProxy nodes have been added""" if not getenv("RHUISKIPSETUP"): RHUIManager.initial_run(RHUA) RHUICLI.add(RHUA, "cds", unsafe=True) RHUICLI.add(RHUA, "haproxy", unsafe=True) # check that cds_list = RHUICLI.list(RHUA, "cds") nose.tools.ok_(cds_list) hap_list = RHUICLI.list(RHUA, "haproxy") nose.tools.ok_(hap_list) # if running RHEL Beta, temporarily restore the non-Beta repos potentially disabled by choose_repo.py cmd = "if grep -q Beta /etc/redhat-release; then " \ "cp /etc/yum.repos.d/redhat-rhui.repo{.disabled,}; " \ "yum-config-manager --enable %s %s; fi" % (BIG_REPO, EMP_REPO) Expect.expect_retval(RHUA, cmd)
def test_01_init(): '''log in to RHUI''' if not getenv("RHUISKIPSETUP"): RHUIManager.initial_run(RHUA)
def test_01_initial_run(): '''Do an initial rhui-manager run to make sure we are logged in''' RHUIManager.initial_run(CONNECTION)
def test_00_initial_run(): """log in to RHUI""" RHUIManager.initial_run(RHUA)
def test_01_initial_run(): '''log in to RHUI''' RHUIManager.initial_run(RHUA)
def test_01_repo_setup(): '''log in to RHUI, upload cert, check if no repo exists''' RHUIManager.initial_run(RHUA) entlist = RHUIManagerEntitlements.upload_rh_certificate(RHUA) nose.tools.ok_(entlist) nose.tools.ok_(not RHUIManagerRepo.list(RHUA))
def test_01_login_add_hap(): """log in to RHUI, add an HAProxy Load-balancer""" RHUIManager.initial_run(RHUA) RHUIManagerInstance.add_instance(RHUA, "loadbalancers")
def test_03_login_with_new_pass(): ''' log in with the new password ''' RHUIManager.initial_run(RHUA, password="******")
def test_01_initial_run(): ''' log in the RHUI (try the "usual" or the default admin password) ''' RHUIManager.initial_run(RHUA)