Beispiel #1
0
 def _test(self):
     '''[TCMS#178466 test] Check cds info screen '''
     cds0 = RhuiCds(
         hostname=self.rs.Instances["CDS"][0].private_hostname,
         cluster="Cluster1",
         repos=[
             "repo1",
             "Red Hat Update Infrastructure 2 (RPMs) (6Server-x86_64)"
         ])
     cds1 = RhuiCds(
         hostname=self.rs.Instances["CDS"][1].private_hostname,
         cluster="Cluster2",
         repos=[
             "repo1",
             "Red Hat Update Infrastructure 2 (RPMs) (6Server-x86_64)"
         ])
     nose.tools.assert_equal(
         sorted(
             RHUIManagerCds.info(self.rs.Instances["RHUA"][0],
                                 ["Cluster1", "Cluster2"])),
         sorted([cds0, cds1]))
     '''[TCMS#178466 test] Check pulp-admin cds list and rhui cds info are the same '''
     pulp_cdses = PulpAdmin.cds_list(self.rs.Instances["RHUA"][0])
     rhui_cdses = RHUIManagerCds.info(self.rs.Instances["RHUA"][0],
                                      ["Cluster1", "Cluster2"])
     nose.tools.assert_equals(sorted(pulp_cdses), sorted(rhui_cdses))
Beispiel #2
0
 def _test(self):
     '''[TCMS#178442 test] Move cds2 to cluster2'''
     RHUIManagerCds.move_cds(self.rs.Instances["RHUA"][0],
                             [self.rs.Instances["CDS"][2].private_hostname],
                             "Cluster2")
     '''[TCMS#178442 test] Check that cds2 moved to cluster2'''
     cds0 = RhuiCds(hostname=self.rs.Instances["CDS"][0].private_hostname,
                    cluster='Cluster1',
                    repos=['repo1'])
     cds1 = RhuiCds(hostname=self.rs.Instances["CDS"][1].private_hostname,
                    cluster='Cluster2',
                    repos=['repo1'])
     cds2 = RhuiCds(hostname=self.rs.Instances["CDS"][2].private_hostname,
                    cluster='Cluster2',
                    repos=['repo1'])
     nose.tools.assert_equal(
         sorted(
             RHUIManagerCds.info(self.rs.Instances["RHUA"][0],
                                 ["Cluster1", "Cluster2"])),
         sorted([cds0, cds1, cds2]))
     '''[TCMS#178442 test] Check pulp-admin and rhui cluster info are the same'''
     nose.tools.assert_equals(
         sorted(PulpAdmin.cds_list(self.rs.Instances["RHUA"][0])),
         sorted(
             RHUIManagerCds.info(self.rs.Instances["RHUA"][0],
                                 ['Cluster1', 'Cluster2'])))
 def _test(self):
     '''[TCMS#178473 test] Check cds info screen '''
     cds0 = RhuiCds(
         hostname=self.rs.Instances["CDS"][0].private_hostname,
         client_hostname=self.rs.Instances["CDS"][0].public_hostname,
         cluster="Cluster1",
         repos=["repo1"])
     cds1 = RhuiCds(
         hostname=self.rs.Instances["CDS"][1].private_hostname,
         client_hostname=self.rs.Instances["CDS"][1].public_hostname,
         cluster="Cluster2",
         repos=["repo1"])
     nose.tools.assert_equal(
         sorted(
             RHUIManagerCds.info(self.rs.Instances["RHUA"][0],
                                 ["Cluster1", "Cluster2"])),
         sorted([cds0, cds1]))
Beispiel #4
0
 def _test(self):
     '''[TCMS#178465 test] Check repos are associated '''
     cds = RhuiCds(hostname=self.rs.Instances["CDS"][0].private_hostname,
                   cluster="Cluster1",
                   repos=["repo1", "repo2"])
     nose.tools.assert_equal(
         RHUIManagerCds.info(self.rs.Instances["RHUA"][0], ["Cluster1"]),
         [cds])
     '''[TCMS#178465 test] Unassociate repo1 from cluster '''
     RHUIManagerCds.unassociate_repo_cds(self.rs.Instances["RHUA"][0],
                                         "Cluster1", ["repo1"])
     '''[TCMS#178465 test] Check repo1 has been unassociated'''
     cds = RhuiCds(hostname=self.rs.Instances["CDS"][0].private_hostname,
                   cluster="Cluster1",
                   repos=["repo2"])
     nose.tools.assert_equal(
         RHUIManagerCds.info(self.rs.Instances["RHUA"][0], ["Cluster1"]),
         [cds])
     '''[TCMS#178465 test] Check pulp-admin cds list and rhui cluster info are the same'''
     pulp_cdses = PulpAdmin.cds_list(self.rs.Instances["RHUA"][0])
     rhui_cdses = RHUIManagerCds.info(self.rs.Instances["RHUA"][0],
                                      ["Cluster1"])
     nose.tools.assert_equals(pulp_cdses, rhui_cdses)
Beispiel #5
0
    def _test(self):
        '''[TCMS#293061 test] Check CDS info screen'''
        rhui_cds = RhuiCds(
            hostname=self.rs.Instances["CDS"][0].private_hostname,
            description='RHUI CDS',
            cluster='Cluster1',
            repos=["repo1"])

        nose.tools.assert_equal(
            RHUIManagerCds.info(self.rs.Instances["RHUA"][0], ["Cluster1"]),
            [rhui_cds])
        '''[TCMS#293061 test] Check pulp-admin and rhui cluster info are the same'''
        nose.tools.assert_equal(
            PulpAdmin.cds_list(self.rs.Instances["RHUA"][0]),
            RHUIManagerCds.info(self.rs.Instances["RHUA"][0], ['Cluster1']))
Beispiel #6
0
 def _test(self):
     '''[TCMS#178464 test] Check cds info screen '''
     cds = RhuiCds(hostname=self.rs.Instances["CDS"][0].private_hostname,
                   cluster="Cluster1",
                   repos=["repo1"])
     nose.tools.assert_equal(
         RHUIManagerCds.info(self.rs.Instances["RHUA"][0], ["Cluster1"]),
         [cds])
     '''[TCMS#178464 test] Check pulp-admin cds list '''
     nose.tools.assert_equals(
         PulpAdmin.cds_list(self.rs.Instances["RHUA"][0]),
         RHUIManagerCds.info(self.rs.Instances["RHUA"][0], ["Cluster1"]))
     '''[TCMS#178464 test] Check certs created for custom repo '''
     Expect.ping_pong(
         self.rs.Instances["RHUA"][0],
         "test -f /etc/pki/pulp/content/repo1/consumer-repo1.cert && echo SUCCESS",
         "[^ ]SUCCESS")
     Expect.ping_pong(
         self.rs.Instances["RHUA"][0],
         "test -f /etc/pki/pulp/content/repo1/consumer-repo1.ca && echo SUCCESS",
         "[^ ]SUCCESS")
    def info(connection, clusterlist):
        '''
        display detailed information on a CDS clusters

        @param clusterlist - list of clusters to examine
        @returns a list of Cds instances
        '''
        RHUIManager.screen(connection, "cds")
        Expect.enter(connection, "i")
        RHUIManager.select(connection, clusterlist)
        pattern = re.compile('.*-= RHUI CDS Clusters =-(.*)rhui\s* \(cds\)\s* =>',
                re.DOTALL)
        ret = Expect.match(connection, pattern, grouplist=[1])[0]
        reslist = ret.split("\r\n")
        i = 0
        clusterlist = []
        cluster = {}
        while i < len(reslist):
            line = reslist[i]
            # Readling lines and searching for clusters
            if line.strip() != '':
                if line[:2] == '  ' and not line[2:3] in [' ', '-']:
                    # We've found a new cluster!
                    if cluster != {}:
                        clusterlist.append(cluster)
                        cluster = {}
                    cluster['Name'] = line[2:]
                    i += 2
                    while reslist[i][:4] == '    ' or reslist[i] == '':
                        if reslist[i] == '':
                            i += 1
                            continue
                        line = reslist[i].strip()
                        if line == "CDS Instances":
                            # Figuring out cds instances
                            instances = []
                            i += 2
                            while reslist[i].strip() != "":
                                # New cds
                                cds = reslist[i].strip()
                                hostname = reslist[i + 1].strip().split(':')[1].strip()
                                client = reslist[i + 2].strip().split(':')[1].strip()
                                instances.append(RhuiCds(name=reslist[i].strip(), hostname=hostname, client_hostname=client,
                                    description='RHUI CDS',
                                    cluster=cluster['Name']))
                                i += 3
                            cluster['Instances'] = sorted(instances)
                        elif line == "Repositories":
                            # Figuring out repositories
                            repositories = []
                            i += 2
                            while reslist[i].strip() != "":
                                # New repo
                                repo = reslist[i].strip()
                                i += 1
                                if repo == '(None)':
                                    # no repos, continue with next (empty)
                                    # line
                                    continue
                                repositories.append(repo)
                            cluster['Repositories'] = repositories
                            # update all cluster CDSes with appropriate repo
                            # records
                            for cds in cluster['Instances']:
                                cds.repos = repositories
                            break
                        else:
                            i += 1
            i += 1

        if cluster != {}:
            clusterlist.append(cluster)
        cdses = []
        for cluster in clusterlist:
            cdses.extend(cluster['Instances'])
        Expect.enter(connection, 'q')
        return cdses