コード例 #1
0
def setup_capsule_content(activation_key_name, content_view_name,
                          organization_id, product_name, rhel_repo_name,
                          rhel_repo_url, satellite_capsule_repo_name,
                          satellite_capsule_repo_url,
                          satellite_tools_repo_name, satellite_tools_repo_url):
    """Setup the content used to provision a capsule.


    :param activation_key_name: name of the activation key which will be
        created
    :param content_view_name: name of the content view which will be created
    :param organization_id: organization where all entities will be created
    :param product_name: name of the product which will be created
    :param rhel_repo_name: name of the RHEL repository which will be created
    :param rhel_repo_url: URL of the RHEL repository which will be created
    :param satellite_capsule_repo_name: name of the capsule repository which
        will be created
    :param satellite_capsule_repo_url: URL of the capsule repository which will
        be created
    :param satellite_tools_repo_name: name of the satellite tools repository
        which will be created
    :param satellite_tools_repo_url: URL of the satellite tools repository
        which will be created
    """
    hammer_product_create(product_name, organization_id)
    hammer_repository_create(rhel_repo_name, organization_id, product_name,
                             rhel_repo_url)
    hammer_repository_create(satellite_capsule_repo_name, organization_id,
                             product_name, satellite_capsule_repo_url)
    hammer_repository_create(satellite_tools_repo_name, organization_id,
                             product_name, satellite_tools_repo_url)
    hammer_repository_synchronize(rhel_repo_name, organization_id,
                                  product_name)
    hammer_repository_synchronize(satellite_capsule_repo_name, organization_id,
                                  product_name)
    hammer_repository_synchronize(satellite_tools_repo_name, organization_id,
                                  product_name)
    hammer_content_view_create(content_view_name, organization_id)
    hammer_content_view_add_repository(content_view_name, organization_id,
                                       product_name, rhel_repo_name)
    hammer_content_view_add_repository(content_view_name, organization_id,
                                       product_name,
                                       satellite_capsule_repo_name)
    hammer_content_view_add_repository(content_view_name, organization_id,
                                       product_name, satellite_tools_repo_name)
    hammer_content_view_publish(content_view_name, organization_id)
    product_id = run(
        "hammer --csv subscription list --organization-id='{0}' "
        "--search='name=\"{1}\"' | awk -F, 'NR>1{{print$8}}'".format(
            organization_id, product_name),
        quiet=True)
    hammer_activation_key_create(activation_key_name, organization_id,
                                 content_view_name)
    hammer_activation_key_add_subscription(activation_key_name,
                                           organization_id, product_id)
コード例 #2
0
    def test_pre_user_scenario_bug_1429201(self):
        """This is pre-upgrade scenario test to verify if we can create a
         custom repository and consume it via client

         :id: 8fb8ec87-efa5-43ed-8cb3-960ef9cd6df2

         :steps:
             1. Create repository RepoFoo that you will later add to your
                Satellite. This repository should contain PackageFoo-1.0.rpm
             2. Install satellite 6.1
             3. Create custom product ProductFoo pointing to repository RepoFoo
             4. Sync RepoFoo
             5. Create content view CVFoo
             6. Add RepoFoo to CVFoo
             7. Publish version 1 of CVFoo

         :expectedresults: The client and product is created successfully

         :BZ: 1429201
         """
        self.create_repo()
        # End to End product + ak association
        print(hammer.hammer_product_create(self.prd_name, self.org_id))
        print(
            hammer.hammer_repository_create(self.repo_name, self.org_id,
                                            self.prd_name, self.custom_repo))
        print(
            hammer.hammer('lifecycle-environment create --name "{0}" '
                          '--organization-id {1} --prior-id "{2}"'.format(
                              self.lc_name, self.org_id, 1)))
        print(
            hammer.hammer_repository_synchronize(self.repo_name, self.org_id,
                                                 self.prd_name))
        print(hammer.hammer_content_view_create(self.cv_name, self.org_id))
        print(
            hammer.hammer_content_view_add_repository(self.cv_name,
                                                      self.org_id,
                                                      self.prd_name,
                                                      self.repo_name))
        print(hammer.hammer_content_view_publish(self.cv_name, self.org_id))
        latest_repo_version = hammer.get_latest_cv_version(self.cv_name)
        lc_result = hammer.hammer('"{0}" info --name "{1}" --organization-id '
                                  '{2}'.format('lifecycle-environment',
                                               self.lc_name, self.org_id))
        lifecycle_id = hammer.get_attribute_value(lc_result, self.lc_name,
                                                  'id')
        print(
            hammer.hammer_content_view_promote_version(self.cv_name,
                                                       latest_repo_version,
                                                       lifecycle_id,
                                                       self.org_id))
        print(
            hammer.hammer_activation_key_create(self.ak_name, self.org_id,
                                                self.cv_name, self.lc_name))
        print(
            hammer.hammer_activation_key_add_subscription(
                self.ak_name, self.org_id, self.prd_name))
        time.sleep(5)
        # Creating a rhel7 vm and subscribing to AK
        container_ids = dockerize(self.ak_name, 'rhel7')
        # Subscription manager needs time to register
        execute(docker_wait_until_repo_list,
                list(container_ids.values())[0],
                host=self.docker_vm)
        result = execute(docker_execute_command,
                         list(container_ids.values())[0],
                         'yum list {0} | grep {0}'.format(
                             self.rpm1_name.split('-')[0]),
                         host=self.docker_vm)
        # Info on created entities to assert the test case using hammer info
        prd_info = hammer.hammer('"{0}" info --name "{1}" --organization-id '
                                 '{2}'.format('product', self.prd_name,
                                              self.org_id))
        self.assertEqual(
            self.prd_name,
            hammer.get_attribute_value(prd_info, self.prd_name, 'name'))
        self.assertIsNotNone(container_ids)
        self.assertIn(self.repo_name, list(result.values())[0])
        global_dict = {
            self.__class__.__name__: {
                'prd_name': self.prd_name,
                'ak_name': self.ak_name,
                'repo_name': self.repo_name,
                'container_ids': container_ids
            }
        }
        create_dict(global_dict)
コード例 #3
0
def setup_capsule_content(
        activation_key_name,
        content_view_name,
        organization_id,
        product_name,
        rhel_repo_name,
        rhel_repo_url,
        satellite_capsule_repo_name,
        satellite_capsule_repo_url,
        satellite_tools_repo_name,
        satellite_tools_repo_url):
    """Setup the content used to provision a capsule.


    :param activation_key_name: name of the activation key which will be
        created
    :param content_view_name: name of the content view which will be created
    :param organization_id: organization where all entities will be created
    :param product_name: name of the product which will be created
    :param rhel_repo_name: name of the RHEL repository which will be created
    :param rhel_repo_url: URL of the RHEL repository which will be created
    :param satellite_capsule_repo_name: name of the capsule repository which
        will be created
    :param satellite_capsule_repo_url: URL of the capsule repository which will
        be created
    :param satellite_tools_repo_name: name of the satellite tools repository
        which will be created
    :param satellite_tools_repo_url: URL of the satellite tools repository
        which will be created
    """
    hammer_product_create(product_name, organization_id)
    hammer_repository_create(
        rhel_repo_name, organization_id, product_name, rhel_repo_url)
    hammer_repository_create(
        satellite_capsule_repo_name,
        organization_id,
        product_name,
        satellite_capsule_repo_url
    )
    hammer_repository_create(
        satellite_tools_repo_name,
        organization_id,
        product_name,
        satellite_tools_repo_url
    )
    hammer_repository_synchronize(
        rhel_repo_name, organization_id, product_name)
    hammer_repository_synchronize(
        satellite_capsule_repo_name, organization_id, product_name)
    hammer_repository_synchronize(
        satellite_tools_repo_name, organization_id, product_name)
    hammer_content_view_create(
        content_view_name, organization_id)
    hammer_content_view_add_repository(
        content_view_name, organization_id, product_name, rhel_repo_name)
    hammer_content_view_add_repository(
        content_view_name,
        organization_id,
        product_name,
        satellite_capsule_repo_name
    )
    hammer_content_view_add_repository(
        content_view_name,
        organization_id,
        product_name,
        satellite_tools_repo_name
    )
    hammer_content_view_publish(content_view_name, organization_id)
    product_id = run(
        "hammer --csv subscription list --organization-id='{0}' "
        "--search='name=\"{1}\"' | awk -F, 'NR>1{{print$8}}'"
        .format(organization_id, product_name),
        quiet=True
    )
    hammer_activation_key_create(
        activation_key_name, organization_id, content_view_name)
    hammer_activation_key_add_subscription(
        activation_key_name, organization_id, product_id)
コード例 #4
0
ファイル: test_contentview.py プロジェクト: jhutar/robottelo
    def test_pre_user_scenario_bug_1429201(self):
        """This is pre-upgrade scenario test to verify if we can create a
         custom repository and consume it via client

         :id: 8fb8ec87-efa5-43ed-8cb3-960ef9cd6df2

         :steps:
             1. Create repository RepoFoo that you will later add to your
                Satellite. This repository should contain PackageFoo-1.0.rpm
             2. Install satellite 6.1
             3. Create custom product ProductFoo pointing to repository RepoFoo
             4. Sync RepoFoo
             5. Create content view CVFoo
             6. Add RepoFoo to CVFoo
             7. Publish version 1 of CVFoo

         :expectedresults: The client and product is created successfully

         :BZ: 1429201
         """
        self.create_repo()
        # End to End product + ak association
        print(hammer.hammer_product_create(self.prd_name, self.org_id))
        print(hammer.hammer_repository_create(
            self.repo_name,
            self.org_id,
            self.prd_name,
            self.custom_repo))
        print(hammer.hammer(
            'lifecycle-environment create --name "{0}" '
            '--organization-id {1} --prior-id "{2}"'.format(
                self.lc_name, self.org_id, 1)))
        print(hammer.hammer_repository_synchronize(
            self.repo_name,
            self.org_id,
            self.prd_name))
        print(hammer.hammer_content_view_create(self.cv_name, self.org_id))
        print(hammer.hammer_content_view_add_repository(
            self.cv_name,
            self.org_id,
            self.prd_name,
            self.repo_name))
        print(hammer.hammer_content_view_publish(self.cv_name, self.org_id))
        latest_repo_version = hammer.get_latest_cv_version(self.cv_name)
        lc_result = hammer.hammer(
            '"{0}" info --name "{1}" --organization-id '
            '{2}'.format('lifecycle-environment',
                         self.lc_name,
                         self.org_id
                         )
                                  )
        lifecycle_id = hammer.get_attribute_value(
            lc_result,
            self.lc_name,
            'id'
            )
        print(hammer.hammer_content_view_promote_version(
            self.cv_name,
            latest_repo_version,
            lifecycle_id,
            self.org_id
            ))
        print(hammer.hammer_activation_key_create(
            self.ak_name,
            self.org_id,
            self.cv_name,
            self.lc_name
            ))
        print(hammer.hammer_activation_key_add_subscription(
            self.ak_name,
            self.org_id,
            self.prd_name
            ))
        time.sleep(5)
        # Creating a rhel7 vm and subscribing to AK
        container_ids = dockerize(self.ak_name, 'rhel7')
        # Subscription manager needs time to register
        execute(docker_wait_until_repo_list,
                list(container_ids.values())[0],
                host=self.docker_vm)
        result = execute(
            docker_execute_command,
            list(container_ids.values())[0],
            'yum list {0} | grep {0}'.format(self.rpm1_name.split('-')[0]),
            host=self.docker_vm
            )
        # Info on created entities to assert the test case using hammer info
        prd_info = hammer.hammer(
            '"{0}" info --name "{1}" --organization-id '
            '{2}'.format('product', self.prd_name, self.org_id)
        )
        self.assertEqual(
            self.prd_name,
            hammer.get_attribute_value(prd_info, self.prd_name, 'name')
        )
        self.assertIsNotNone(container_ids)
        self.assertIn(self.repo_name, list(result.values())[0])
        global_dict = {self.__class__.__name__: {
            'prd_name': self.prd_name,
            'ak_name': self.ak_name,
            'repo_name': self.repo_name,
            'container_ids': container_ids
        }
        }
        create_dict(global_dict)