Esempio n. 1
0
    def test_positive_end_to_end(self):
        """Perform end to end smoke tests using RH and custom repos.

        1. Create a new user with admin permissions
        2. Using the new user from above
            1. Create a new organization
            2. Clone and upload manifest
            3. Create a new lifecycle environment
            4. Create a custom product
            5. Create a custom YUM repository
            6. Create a custom PUPPET repository
            7. Enable a Red Hat repository
            8. Synchronize the three repositories
            9. Create a new content view
            10. Associate the YUM and Red Hat repositories to new content view
            11. Add a PUPPET module to new content view
            12. Publish content view
            13. Promote content view to the lifecycle environment
            14. Create a new activation key
            15. Add the products to the activation key
            16. Create a new libvirt compute resource
            17. Create a new subnet
            18. Create a new domain
            19. Create a new hostgroup and associate previous entities to it
            20. Provision a client

        @id: 8c8b3ffa-0d54-436b-8eeb-1a3542e100a8

        @Assert: All tests should succeed and Content should be successfully
        fetched by client.
        """
        # step 1: Create a new user with admin permissions
        password = gen_alphanumeric()
        user = make_user({u'admin': u'true', u'password': password})
        user['password'] = password

        # step 2.1: Create a new organization
        org = self._create(user, Org, {u'name': gen_alphanumeric()})

        # step 2.2: Clone and upload manifest
        if self.fake_manifest_is_set:
            with manifests.clone() as manifest:
                ssh.upload_file(manifest.content, manifest.filename)
            Subscription.upload({
                u'file': manifest.filename,
                u'organization-id': org['id'],
            })

        # step 2.3: Create a new lifecycle environment
        lifecycle_environment = self._create(
            user,
            LifecycleEnvironment,
            {
                u'name': gen_alphanumeric(),
                u'organization-id': org['id'],
                u'prior': u'Library',
            }
        )

        # step 2.4: Create a custom product
        product = self._create(
            user,
            Product,
            {
                u'name': gen_alphanumeric(),
                u'organization-id': org['id'],
            }
        )
        repositories = []

        # step 2.5: Create custom YUM repository
        yum_repo = self._create(
            user,
            Repository,
            {
                u'content-type': u'yum',
                u'name': gen_alphanumeric(),
                u'product-id': product['id'],
                u'publish-via-http': u'true',
                u'url': GOOGLE_CHROME_REPO,
            }
        )
        repositories.append(yum_repo)

        # step 2.6: Create custom PUPPET repository
        puppet_repo = self._create(
            user,
            Repository,
            {
                u'content-type': u'puppet',
                u'name': gen_alphanumeric(),
                u'product-id': product['id'],
                u'publish-via-http': u'true',
                u'url': FAKE_0_PUPPET_REPO,
            }
        )
        repositories.append(puppet_repo)

        # step 2.7: Enable a Red Hat repository
        if self.fake_manifest_is_set:
            RepositorySet.enable({
                u'basearch': 'x86_64',
                u'name': REPOSET['rhva6'],
                u'organization-id': org['id'],
                u'product': PRDS['rhel'],
                u'releasever': '6Server',
            })
            rhel_repo = Repository.info({
                u'name': REPOS['rhva6']['name'],
                u'organization-id': org['id'],
                u'product': PRDS['rhel'],
            })
            repositories.append(rhel_repo)

        # step 2.8: Synchronize the three repositories
        for repo in repositories:
            Repository.with_user(
                user['login'],
                user['password']
            ).synchronize({u'id': repo['id']})

        # step 2.9: Create content view
        content_view = self._create(
            user,
            ContentView,
            {
                u'name': gen_alphanumeric(),
                u'organization-id': org['id'],
            }
        )

        # step 2.10: Associate the YUM and Red Hat repositories to new content
        # view
        repositories.remove(puppet_repo)
        for repo in repositories:
            ContentView.add_repository({
                u'id': content_view['id'],
                u'organization-id': org['id'],
                u'repository-id': repo['id'],
            })

        # step 2.11: Add a PUPPET module to new content view
        result = PuppetModule.with_user(
            user['login'],
            user['password']
        ).list({
            u'repository-id': puppet_repo['id'],
            u'per-page': False,
        })
        ContentView.with_user(
            user['login'],
            user['password']
        ).puppet_module_add({
            u'content-view-id': content_view['id'],
            u'id': random.choice(result)['id'],
        })

        # step 2.12: Publish content view
        ContentView.with_user(
            user['login'],
            user['password']
        ).publish({u'id': content_view['id']})

        # step 2.13: Promote content view to the lifecycle environment
        content_view = ContentView.with_user(
            user['login'],
            user['password']
        ).info({u'id': content_view['id']})
        self.assertEqual(len(content_view['versions']), 1)
        cv_version = ContentView.with_user(
            user['login'],
            user['password']
        ).version_info({
            'id': content_view['versions'][0]['id'],
        })
        self.assertEqual(len(cv_version['lifecycle-environments']), 1)
        ContentView.with_user(
            user['login'],
            user['password']
        ).version_promote({
            u'id': cv_version['id'],
            u'to-lifecycle-environment-id': lifecycle_environment['id'],
        })
        # check that content view exists in lifecycle
        content_view = ContentView.with_user(
            user['login'],
            user['password']
        ).info({u'id': content_view['id']})
        self.assertEqual(len(content_view['versions']), 1)
        cv_version = ContentView.with_user(
            user['login'],
            user['password']
        ).version_info({
            'id': content_view['versions'][0]['id'],
        })
        self.assertEqual(len(cv_version['lifecycle-environments']), 2)
        self.assertEqual(
            cv_version['lifecycle-environments'][-1]['id'],
            lifecycle_environment['id']
        )

        # step 2.14: Create a new activation key
        activation_key = self._create(
            user,
            ActivationKey,
            {
                u'content-view-id': content_view['id'],
                u'lifecycle-environment-id': lifecycle_environment['id'],
                u'name': gen_alphanumeric(),
                u'organization-id': org['id'],
            }
        )

        # step 2.15: Add the products to the activation key
        subscription_list = Subscription.with_user(
            user['login'],
            user['password']
        ).list(
            {u'organization-id': org['id']},
            per_page=False
        )
        for subscription in subscription_list:
            if subscription['name'] == DEFAULT_SUBSCRIPTION_NAME:
                ActivationKey.with_user(
                    user['login'],
                    user['password']
                ).add_subscription({
                    u'id': activation_key['id'],
                    u'quantity': 1,
                    u'subscription-id': subscription['id'],
                })

        # step 2.15.1: Enable product content
        if self.fake_manifest_is_set:
            ActivationKey.with_user(
                user['login'],
                user['password']
            ).content_override({
                u'content-label': AK_CONTENT_LABEL,
                u'id': activation_key['id'],
                u'organization-id': org['id'],
                u'value': '1',
            })

        # BONUS: Create a content host and associate it with promoted
        # content view and last lifecycle where it exists
        content_host_name = gen_alphanumeric()
        content_host = Host.with_user(
            user['login'],
            user['password']
        ).subscription_register({
            u'content-view-id': content_view['id'],
            u'lifecycle-environment-id': lifecycle_environment['id'],
            u'name': content_host_name,
            u'organization-id': org['id'],
        })
        if bz_bug_is_open(1328202):
            results = ContentHost.with_user(
                user['login'],
                user['password']
            ).list({
                'organization-id': org['id']
            })
            # Content host registration converts the name to lowercase, make
            # sure to use the same format while matching against the result
            content_host_name = content_host_name.lower()
            for result in results:
                if result['name'] == content_host_name:
                    content_host = result
        content_host = ContentHost.with_user(
            user['login'],
            user['password']
        ).info({'id': content_host['id']})
        # check that content view matches what we passed
        self.assertEqual(
            content_host['content-view'],
            content_view['name']
        )
        # check that lifecycle environment matches
        self.assertEqual(
            content_host['lifecycle-environment'],
            lifecycle_environment['name']
        )

        # step 2.16: Create a new libvirt compute resource
        self._create(
            user,
            ComputeResource,
            {
                u'name': gen_alphanumeric(),
                u'provider': u'Libvirt',
                u'url': u'qemu+ssh://root@{0}/system'.format(
                    settings.compute_resources.libvirt_hostname
                ),
            }
        )

        # step 2.17: Create a new subnet
        subnet = self._create(
            user,
            Subnet,
            {
                u'name': gen_alphanumeric(),
                u'network': gen_ipaddr(ip3=True),
                u'mask': u'255.255.255.0',
            }
        )

        # step 2.18: Create a new domain
        domain = self._create(user, Domain, {u'name': gen_alphanumeric()})

        # step 2.19: Create a new hostgroup and associate previous entities to
        # it
        host_group = self._create(
            user,
            HostGroup,
            {
                u'domain-id': domain['id'],
                u'name': gen_alphanumeric(),
                u'subnet-id': subnet['id'],
            }
        )
        if not bz_bug_is_open('1326101'):
            Org.with_user(
                user['login'],
                user['password']
            ).add_hostgroup({
                u'hostgroup-id': host_group['id'],
                u'id': org['id'],
            })

        # step 2.20: Provision a client
        self.client_provisioning(activation_key['name'], org['label'])
Esempio n. 2
0
    def test_positive_end_to_end(self):
        """Perform end to end smoke tests using RH and custom repos.

        1. Create a new user with admin permissions
        2. Using the new user from above
            1. Create a new organization
            2. Clone and upload manifest
            3. Create a new lifecycle environment
            4. Create a custom product
            5. Create a custom YUM repository
            6. Create a custom PUPPET repository
            7. Enable a Red Hat repository
            8. Synchronize the three repositories
            9. Create a new content view
            10. Associate the YUM and Red Hat repositories to new content view
            11. Add a PUPPET module to new content view
            12. Publish content view
            13. Promote content view to the lifecycle environment
            14. Create a new activation key
            15. Add the products to the activation key
            16. Create a new libvirt compute resource
            17. Create a new subnet
            18. Create a new domain
            19. Create a new hostgroup and associate previous entities to it
            20. Provision a client

        @id: 8c8b3ffa-0d54-436b-8eeb-1a3542e100a8

        @Assert: All tests should succeed and Content should be successfully
        fetched by client.
        """
        # step 1: Create a new user with admin permissions
        password = gen_alphanumeric()
        user = make_user({u'admin': u'true', u'password': password})
        user['password'] = password

        # step 2.1: Create a new organization
        org = self._create(user, Org, {u'name': gen_alphanumeric()})

        # step 2.2: Clone and upload manifest
        if self.fake_manifest_is_set:
            with manifests.clone() as manifest:
                ssh.upload_file(manifest.content, manifest.filename)
            Subscription.upload({
                u'file': manifest.filename,
                u'organization-id': org['id'],
            })

        # step 2.3: Create a new lifecycle environment
        lifecycle_environment = self._create(
            user, LifecycleEnvironment, {
                u'name': gen_alphanumeric(),
                u'organization-id': org['id'],
                u'prior': u'Library',
            })

        # step 2.4: Create a custom product
        product = self._create(user, Product, {
            u'name': gen_alphanumeric(),
            u'organization-id': org['id'],
        })
        repositories = []

        # step 2.5: Create custom YUM repository
        yum_repo = self._create(
            user, Repository, {
                u'content-type': u'yum',
                u'name': gen_alphanumeric(),
                u'product-id': product['id'],
                u'publish-via-http': u'true',
                u'url': GOOGLE_CHROME_REPO,
            })
        repositories.append(yum_repo)

        # step 2.6: Create custom PUPPET repository
        puppet_repo = self._create(
            user, Repository, {
                u'content-type': u'puppet',
                u'name': gen_alphanumeric(),
                u'product-id': product['id'],
                u'publish-via-http': u'true',
                u'url': FAKE_0_PUPPET_REPO,
            })
        repositories.append(puppet_repo)

        # step 2.7: Enable a Red Hat repository
        if self.fake_manifest_is_set:
            RepositorySet.enable({
                u'basearch': 'x86_64',
                u'name': REPOSET['rhva6'],
                u'organization-id': org['id'],
                u'product': PRDS['rhel'],
                u'releasever': '6Server',
            })
            rhel_repo = Repository.info({
                u'name': REPOS['rhva6']['name'],
                u'organization-id': org['id'],
                u'product': PRDS['rhel'],
            })
            repositories.append(rhel_repo)

        # step 2.8: Synchronize the three repositories
        for repo in repositories:
            Repository.with_user(user['login'], user['password']).synchronize(
                {u'id': repo['id']})

        # step 2.9: Create content view
        content_view = self._create(user, ContentView, {
            u'name': gen_alphanumeric(),
            u'organization-id': org['id'],
        })

        # step 2.10: Associate the YUM and Red Hat repositories to new content
        # view
        repositories.remove(puppet_repo)
        for repo in repositories:
            ContentView.add_repository({
                u'id': content_view['id'],
                u'organization-id': org['id'],
                u'repository-id': repo['id'],
            })

        # step 2.11: Add a PUPPET module to new content view
        result = PuppetModule.with_user(user['login'], user['password']).list({
            u'repository-id':
            puppet_repo['id'],
            u'per-page':
            False,
        })
        ContentView.with_user(user['login'],
                              user['password']).puppet_module_add({
                                  u'content-view-id':
                                  content_view['id'],
                                  u'id':
                                  random.choice(result)['id'],
                              })

        # step 2.12: Publish content view
        ContentView.with_user(user['login'], user['password']).publish(
            {u'id': content_view['id']})

        # step 2.13: Promote content view to the lifecycle environment
        content_view = ContentView.with_user(
            user['login'], user['password']).info({u'id': content_view['id']})
        self.assertEqual(len(content_view['versions']), 1)
        cv_version = ContentView.with_user(
            user['login'], user['password']).version_info({
                'id':
                content_view['versions'][0]['id'],
            })
        self.assertEqual(len(cv_version['lifecycle-environments']), 1)
        ContentView.with_user(user['login'],
                              user['password']).version_promote({
                                  u'id':
                                  cv_version['id'],
                                  u'to-lifecycle-environment-id':
                                  lifecycle_environment['id'],
                              })
        # check that content view exists in lifecycle
        content_view = ContentView.with_user(
            user['login'], user['password']).info({u'id': content_view['id']})
        self.assertEqual(len(content_view['versions']), 1)
        cv_version = ContentView.with_user(
            user['login'], user['password']).version_info({
                'id':
                content_view['versions'][0]['id'],
            })
        self.assertEqual(len(cv_version['lifecycle-environments']), 2)
        self.assertEqual(cv_version['lifecycle-environments'][-1]['id'],
                         lifecycle_environment['id'])

        # step 2.14: Create a new activation key
        activation_key = self._create(
            user, ActivationKey, {
                u'content-view-id': content_view['id'],
                u'lifecycle-environment-id': lifecycle_environment['id'],
                u'name': gen_alphanumeric(),
                u'organization-id': org['id'],
            })

        # step 2.15: Add the products to the activation key
        subscription_list = Subscription.with_user(
            user['login'],
            user['password']).list({u'organization-id': org['id']},
                                   per_page=False)
        for subscription in subscription_list:
            if subscription['name'] == DEFAULT_SUBSCRIPTION_NAME:
                ActivationKey.with_user(user['login'],
                                        user['password']).add_subscription({
                                            u'id':
                                            activation_key['id'],
                                            u'quantity':
                                            1,
                                            u'subscription-id':
                                            subscription['id'],
                                        })

        # step 2.15.1: Enable product content
        if self.fake_manifest_is_set:
            ActivationKey.with_user(user['login'],
                                    user['password']).content_override({
                                        u'content-label':
                                        AK_CONTENT_LABEL,
                                        u'id':
                                        activation_key['id'],
                                        u'organization-id':
                                        org['id'],
                                        u'value':
                                        '1',
                                    })

        # BONUS: Create a content host and associate it with promoted
        # content view and last lifecycle where it exists
        content_host_name = gen_alphanumeric()
        content_host = Host.with_user(user['login'],
                                      user['password']).subscription_register({
                                          u'content-view-id':
                                          content_view['id'],
                                          u'lifecycle-environment-id':
                                          lifecycle_environment['id'],
                                          u'name':
                                          content_host_name,
                                          u'organization-id':
                                          org['id'],
                                      })
        if bz_bug_is_open(1328202):
            results = ContentHost.with_user(user['login'],
                                            user['password']).list(
                                                {'organization-id': org['id']})
            # Content host registration converts the name to lowercase, make
            # sure to use the same format while matching against the result
            content_host_name = content_host_name.lower()
            for result in results:
                if result['name'] == content_host_name:
                    content_host = result
        content_host = ContentHost.with_user(
            user['login'], user['password']).info({'id': content_host['id']})
        # check that content view matches what we passed
        self.assertEqual(content_host['content-view'], content_view['name'])
        # check that lifecycle environment matches
        self.assertEqual(content_host['lifecycle-environment'],
                         lifecycle_environment['name'])

        # step 2.16: Create a new libvirt compute resource
        self._create(
            user, ComputeResource, {
                u'name':
                gen_alphanumeric(),
                u'provider':
                u'Libvirt',
                u'url':
                u'qemu+ssh://root@{0}/system'.format(
                    settings.compute_resources.libvirt_hostname),
            })

        # step 2.17: Create a new subnet
        subnet = self._create(
            user, Subnet, {
                u'name': gen_alphanumeric(),
                u'network': gen_ipaddr(ip3=True),
                u'mask': u'255.255.255.0',
            })

        # step 2.18: Create a new domain
        domain = self._create(user, Domain, {u'name': gen_alphanumeric()})

        # step 2.19: Create a new hostgroup and associate previous entities to
        # it
        host_group = self._create(
            user, HostGroup, {
                u'domain-id': domain['id'],
                u'name': gen_alphanumeric(),
                u'subnet-id': subnet['id'],
            })
        if not bz_bug_is_open('1326101'):
            Org.with_user(user['login'], user['password']).add_hostgroup({
                u'hostgroup-id':
                host_group['id'],
                u'id':
                org['id'],
            })

        # step 2.20: Provision a client
        self.client_provisioning(activation_key['name'], org['label'])
def test_positive_cli_end_to_end(fake_manifest_is_set, rhel6_contenthost,
                                 default_sat):
    """Perform end to end smoke tests using RH and custom repos.

    1. Create a new user with admin permissions
    2. Using the new user from above
        1. Create a new organization
        2. Clone and upload manifest
        3. Create a new lifecycle environment
        4. Create a custom product
        5. Create a custom YUM repository
        6. Enable a Red Hat repository
        7. Synchronize the three repositories
        8. Create a new content view
        9. Associate the YUM and Red Hat repositories to new content view
        10. Publish content view
        11. Promote content view to the lifecycle environment
        12. Create a new activation key
        13. Add the products to the activation key
        14. Create a new libvirt compute resource
        15. Create a new subnet
        16. Create a new domain
        17. Create a new hostgroup and associate previous entities to it
        18. Provision a client  ** NOT CURRENTLY PROVISIONING

    :id: 8c8b3ffa-0d54-436b-8eeb-1a3542e100a8

    :expectedresults: All tests should succeed and Content should be
        successfully fetched by client.
    """
    # step 1: Create a new user with admin permissions
    password = gen_alphanumeric()
    user = make_user({'admin': 'true', 'password': password})
    user['password'] = password

    # step 2.1: Create a new organization
    org = _create(user, Org, {'name': gen_alphanumeric()})

    # step 2.2: Clone and upload manifest
    if fake_manifest_is_set:
        with manifests.clone() as manifest:
            default_sat.put(manifest, manifest.filename)
        Subscription.upload({
            'file': manifest.filename,
            'organization-id': org['id']
        })

    # step 2.3: Create a new lifecycle environment
    lifecycle_environment = _create(
        user,
        LifecycleEnvironment,
        {
            'name': gen_alphanumeric(),
            'organization-id': org['id'],
            'prior': 'Library'
        },
    )

    # step 2.4: Create a custom product
    product = _create(user, Product, {
        'name': gen_alphanumeric(),
        'organization-id': org['id']
    })
    repositories = []

    # step 2.5: Create custom YUM repository
    yum_repo = _create(
        user,
        Repository,
        {
            'content-type': 'yum',
            'name': gen_alphanumeric(),
            'product-id': product['id'],
            'publish-via-http': 'true',
            'url': CUSTOM_RPM_REPO,
        },
    )
    repositories.append(yum_repo)

    # step 2.6: Enable a Red Hat repository
    if fake_manifest_is_set:
        RepositorySet.enable({
            'basearch': 'x86_64',
            'name': REPOSET['rhva6'],
            'organization-id': org['id'],
            'product': PRDS['rhel'],
            'releasever': '6Server',
        })
        rhel_repo = Repository.info({
            'name': REPOS['rhva6']['name'],
            'organization-id': org['id'],
            'product': PRDS['rhel'],
        })
        repositories.append(rhel_repo)

    # step 2.7: Synchronize the three repositories
    for repo in repositories:
        Repository.with_user(user['login'],
                             user['password']).synchronize({'id': repo['id']})

    # step 2.8: Create content view
    content_view = _create(user, ContentView, {
        'name': gen_alphanumeric(),
        'organization-id': org['id']
    })

    # step 2.9: Associate the YUM and Red Hat repositories to new content view
    for repo in repositories:
        ContentView.add_repository({
            'id': content_view['id'],
            'organization-id': org['id'],
            'repository-id': repo['id'],
        })

    # step 2.10: Publish content view
    ContentView.with_user(user['login'],
                          user['password']).publish({'id': content_view['id']})

    # step 2.11: Promote content view to the lifecycle environment
    content_view = ContentView.with_user(user['login'], user['password']).info(
        {'id': content_view['id']})
    assert len(content_view['versions']) == 1
    cv_version = ContentView.with_user(user['login'],
                                       user['password']).version_info({
                                           'id':
                                           content_view['versions'][0]['id']
                                       })
    assert len(cv_version['lifecycle-environments']) == 1
    ContentView.with_user(user['login'], user['password']).version_promote({
        'id':
        cv_version['id'],
        'to-lifecycle-environment-id':
        lifecycle_environment['id']
    })
    # check that content view exists in lifecycle
    content_view = ContentView.with_user(user['login'], user['password']).info(
        {'id': content_view['id']})
    assert len(content_view['versions']) == 1
    cv_version = ContentView.with_user(user['login'],
                                       user['password']).version_info({
                                           'id':
                                           content_view['versions'][0]['id']
                                       })
    assert len(cv_version['lifecycle-environments']) == 2
    assert cv_version['lifecycle-environments'][-1][
        'id'] == lifecycle_environment['id']

    # step 2.12: Create a new activation key
    activation_key = _create(
        user,
        ActivationKey,
        {
            'content-view-id': content_view['id'],
            'lifecycle-environment-id': lifecycle_environment['id'],
            'name': gen_alphanumeric(),
            'organization-id': org['id'],
        },
    )

    # step 2.13: Add the products to the activation key
    subscription_list = Subscription.with_user(
        user['login'], user['password']).list({'organization-id': org['id']},
                                              per_page=False)
    for subscription in subscription_list:
        if subscription['name'] == DEFAULT_SUBSCRIPTION_NAME:
            ActivationKey.with_user(user['login'],
                                    user['password']).add_subscription({
                                        'id':
                                        activation_key['id'],
                                        'quantity':
                                        1,
                                        'subscription-id':
                                        subscription['id'],
                                    })

    # step 2.13.1: Enable product content
    if fake_manifest_is_set:
        ActivationKey.with_user(user['login'],
                                user['password']).content_override({
                                    'content-label':
                                    AK_CONTENT_LABEL,
                                    'id':
                                    activation_key['id'],
                                    'organization-id':
                                    org['id'],
                                    'value':
                                    '1',
                                })

    # BONUS: Create a content host and associate it with promoted
    # content view and last lifecycle where it exists
    content_host_name = gen_alphanumeric()
    content_host = Host.with_user(user['login'],
                                  user['password']).subscription_register({
                                      'content-view-id':
                                      content_view['id'],
                                      'lifecycle-environment-id':
                                      lifecycle_environment['id'],
                                      'name':
                                      content_host_name,
                                      'organization-id':
                                      org['id'],
                                  })

    content_host = Host.with_user(user['login'], user['password']).info(
        {'id': content_host['id']})
    # check that content view matches what we passed
    assert content_host['content-information']['content-view'][
        'name'] == content_view['name']

    # check that lifecycle environment matches
    assert (content_host['content-information']['lifecycle-environment']
            ['name'] == lifecycle_environment['name'])

    # step 2.14: Create a new libvirt compute resource
    _create(
        user,
        ComputeResource,
        {
            'name': gen_alphanumeric(),
            'provider': 'Libvirt',
            'url':
            f'qemu+ssh://root@{settings.libvirt.libvirt_hostname}/system',
        },
    )

    # step 2.15: Create a new subnet
    subnet = _create(
        user,
        Subnet,
        {
            'name': gen_alphanumeric(),
            'network': gen_ipaddr(ip3=True),
            'mask': '255.255.255.0',
        },
    )

    # step 2.16: Create a new domain
    domain = _create(user, Domain, {'name': gen_alphanumeric()})

    # step 2.17: Create a new hostgroup and associate previous entities to it
    host_group = _create(
        user,
        HostGroup,
        {
            'domain-id': domain['id'],
            'name': gen_alphanumeric(),
            'subnet-id': subnet['id']
        },
    )
    HostGroup.with_user(user['login'], user['password']).update({
        'id':
        host_group['id'],
        'organization-ids':
        org['id'],
        'content-view-id':
        content_view['id'],
        'lifecycle-environment-id':
        lifecycle_environment['id'],
    })

    # step 2.18: Provision a client
    # TODO this isn't provisioning through satellite as intended
    # Note it wasn't well before the change that added this todo
    rhel6_contenthost.install_katello_ca(default_sat)
    # Register client with foreman server using act keys
    rhel6_contenthost.register_contenthost(org['label'],
                                           activation_key['name'])
    assert rhel6_contenthost.subscribed
    # Install rpm on client
    package_name = 'python-kitchen'
    result = rhel6_contenthost.execute(f'yum install -y {package_name}')
    assert result.status == 0
    # Verify that the package is installed by querying it
    result = rhel6_contenthost.run(f'rpm -q {package_name}')
    assert result.status == 0