def test_positive_import_puppet_classes(self): """Import puppet classes from proxy :id: 42e3a9c0-62e1-4049-9667-f3c0cdfe0b04 :expectedresults: Puppet classes are imported from proxy :CaseImportance: Critical """ port = get_available_capsule_port() with default_url_on_new_port(9090, port) as url: proxy = self._make_proxy({u'url': url}) Proxy.import_classes({u'id': proxy['id']})
def test_positive_import_puppet_classes(request): """Import puppet classes from proxy :id: 42e3a9c0-62e1-4049-9667-f3c0cdfe0b04 :expectedresults: Puppet classes are imported from proxy :CaseLevel: Component """ port = get_available_capsule_port() with default_url_on_new_port(9090, port) as url: proxy = _make_proxy(request, {'url': url}) Proxy.import_classes({'id': proxy['id']})
def test_positive_import_puppet_classes(session_puppet_enabled_sat, puppet_proxy_port_range): """Import puppet classes from proxy :id: 42e3a9c0-62e1-4049-9667-f3c0cdfe0b04 :expectedresults: Puppet classes are imported from proxy :CaseLevel: Component """ with session_puppet_enabled_sat: port = get_available_capsule_port() with default_url_on_new_port(9090, port) as url: proxy = make_proxy({'url': url}) Proxy.import_classes({'id': proxy['id']}) Proxy.delete({'id': proxy['id']})
def configure_puppet_test(): sat6_hostname = settings.server.hostname repo_values = [ { 'repo': REPOS['rhst6']['name'], 'reposet': REPOSET['rhst6'] }, { 'repo': REPOS['rhst7']['name'], 'reposet': REPOSET['rhst7'] }, ] # step 1: Create new organization and environment. org = entities.Organization(name=gen_string('alpha')).create() loc = entities.Location(name=DEFAULT_LOC).search()[0].read() puppet_env = entities.Environment(name='production').search()[0].read() puppet_env.location.append(loc) puppet_env.organization.append(org) puppet_env = puppet_env.update(['location', 'organization']) Proxy.import_classes({ u'environment': puppet_env.name, u'name': sat6_hostname, }) env = entities.LifecycleEnvironment(organization=org, name=gen_string('alpha')).create() # step 2: Clone and Upload manifest with manifests.clone() as manifest: upload_manifest(org.id, manifest.content) # step 3: Sync RedHat Sattools RHEL6 and RHEL7 repository repos = [ entities.Repository(id=enable_rhrepo_and_fetchid( basearch='x86_64', org_id=org.id, product=PRDS['rhel'], repo=value['repo'], reposet=value['reposet'], releasever=None, )) for value in repo_values ] for repo in repos: repo.sync() # step 4: Create content view content_view = entities.ContentView(organization=org, name=gen_string('alpha')).create() # step 5: Associate repository to new content view content_view.repository = repos content_view = content_view.update(['repository']) # step 6: Publish content view and promote to lifecycle env. content_view.publish() content_view = content_view.read() promote(content_view.version[0], env.id) # step 7: Create activation key ak_name = gen_string('alpha') activation_key = entities.ActivationKey( name=ak_name, environment=env, organization=org, content_view=content_view, ).create() # step 7.1: Walk through the list of subscriptions. # Find the "Employee SKU" and attach it to the # recently-created activation key. for sub in entities.Subscription(organization=org).search(): if sub.read_json()['product_name'] == DEFAULT_SUBSCRIPTION_NAME: # 'quantity' must be 1, not subscription['quantity']. Greater # values produce this error: "RuntimeError: Error: Only pools # with multi-entitlement product subscriptions can be added to # the activation key with a quantity greater than one." activation_key.add_subscriptions(data={ 'quantity': 1, 'subscription_id': sub.id, }) break for content_label in [REPOS['rhst6']['id'], REPOS['rhst7']['id']]: # step 7.2: Enable product content activation_key.content_override( data={ 'content_override': { u'content_label': content_label, u'value': u'1', } }) return { 'org_name': org.name, 'cv_name': content_view.name, 'sat6_hostname': settings.server.hostname, 'ak_name': ak_name, 'env_name': env.name, }
def configure_puppet_test(cls): """Sets up the whole provisioning environment needed for Puppet based end-to-end tests like OSCAP etc :returns: A dict of entities to help with provisioning """ cls.rhel6_content = OSCAP_DEFAULT_CONTENT['rhel6_content'] cls.rhel7_content = OSCAP_DEFAULT_CONTENT['rhel7_content'] sat6_hostname = settings.server.hostname ak_name_7 = gen_string('alpha') ak_name_6 = gen_string('alpha') repo_values = [ { 'repo': settings.sattools_repo['rhel6'], 'akname': ak_name_6 }, { 'repo': settings.sattools_repo['rhel7'], 'akname': ak_name_7 }, ] # Create new organization and environment. org = entities.Organization(name=gen_string('alpha')).create() loc = entities.Location(name=DEFAULT_LOC).search()[0].read() puppet_env = entities.Environment().search( query={u'search': u'name=production'})[0].read() puppet_env.location.append(loc) puppet_env.organization.append(org) puppet_env = puppet_env.update(['location', 'organization']) Proxy.import_classes({ u'environment': puppet_env.name, u'name': sat6_hostname, }) env = entities.LifecycleEnvironment(organization=org, name=gen_string('alpha')).create() # Create content view content_view = entities.ContentView(organization=org, name=gen_string('alpha')).create() # Create two activation keys for rhel7 and rhel6 for repo in repo_values: activation_key = entities.ActivationKey( name=repo.get('akname'), environment=env, organization=org, ).create() # Setup org for a custom repo for RHEL6 and RHEL7 setup_org_for_a_custom_repo({ 'url': repo.get('repo'), 'organization-id': org.id, 'content-view-id': content_view.id, 'lifecycle-environment-id': env.id, 'activationkey-id': activation_key.id }) for content in cls.rhel6_content, cls.rhel7_content: Scapcontent.update({'title': content, 'organizations': org.name}) return { 'org_name': org.name, 'cv_name': content_view.name, 'sat6_hostname': settings.server.hostname, 'ak_name': { 'rhel7': ak_name_7, 'rhel6': ak_name_6 }, 'env_name': env.name, }
def configure_puppet_test(cls): """Sets up the whole provisioning environment needed for Puppet based end-to-end tests like OSCAP etc :returns: A dict of entities to help with provisioning """ cls.rhel6_content = OSCAP_DEFAULT_CONTENT['rhel6_content'] cls.rhel7_content = OSCAP_DEFAULT_CONTENT['rhel7_content'] sat6_hostname = settings.server.hostname ak_name_7 = gen_string('alpha') ak_name_6 = gen_string('alpha') repo_values = [ { 'repo': REPOS['rhst6']['name'], 'reposet': REPOSET['rhst6'], 'akname': ak_name_6 }, { 'repo': REPOS['rhst7']['name'], 'reposet': REPOSET['rhst7'], 'akname': ak_name_7 }, ] # Create new organization and environment. org = entities.Organization(name=gen_string('alpha')).create() loc = entities.Location(name=DEFAULT_LOC).search()[0].read() puppet_env = entities.Environment().search( query={u'search': u'name=production'})[0].read() puppet_env.location.append(loc) puppet_env.organization.append(org) puppet_env = puppet_env.update(['location', 'organization']) Proxy.import_classes({ u'environment': puppet_env.name, u'name': sat6_hostname, }) env = entities.LifecycleEnvironment( organization=org, name=gen_string('alpha') ).create() # Clone and Upload manifest with manifests.clone() as manifest: upload_manifest(org.id, manifest.content) # Create content view content_view = entities.ContentView( organization=org, name=gen_string('alpha') ).create() # Create two activation keys for rhel7 and rhel6 for repo in repo_values: activation_key = entities.ActivationKey( name=repo.get('akname'), environment=env, organization=org, ).create() # Setup org for a RH or custom repo for RHEL6 and RHEL7 setup_org_for_a_rh_repo({ 'product': PRDS['rhel'], 'repository-set': repo.get('reposet'), 'repository': repo.get('repo'), 'organization-id': org.id, 'content-view-id': content_view.id, 'lifecycle-environment-id': env.id, 'activationkey-id': activation_key.id, }) for content in cls.rhel6_content, cls.rhel7_content: Scapcontent.update({ 'title': content, 'organizations': org.name}) return { 'org_name': org.name, 'cv_name': content_view.name, 'sat6_hostname': settings.server.hostname, 'ak_name': {'rhel7': ak_name_7, 'rhel6': ak_name_6}, 'env_name': env.name, }
def configure_puppet_test(): sat6_hostname = settings.server.hostname repo_values = [ {'repo': REPOS['rhst6']['name'], 'reposet': REPOSET['rhst6']}, {'repo': REPOS['rhst7']['name'], 'reposet': REPOSET['rhst7']}, ] # step 1: Create new organization and environment. org = entities.Organization(name=gen_string('alpha')).create() loc = entities.Location(name=DEFAULT_LOC).search()[0].read() puppet_env = entities.Environment( name='production').search()[0].read() puppet_env.location.append(loc) puppet_env.organization.append(org) puppet_env = puppet_env.update(['location', 'organization']) Proxy.import_classes({ u'environment': puppet_env.name, u'name': sat6_hostname, }) env = entities.LifecycleEnvironment( organization=org, name=gen_string('alpha') ).create() # step 2: Clone and Upload manifest with manifests.clone() as manifest: upload_manifest(org.id, manifest.content) # step 3: Sync RedHat Sattools RHEL6 and RHEL7 repository repos = [ entities.Repository(id=enable_rhrepo_and_fetchid( basearch='x86_64', org_id=org.id, product=PRDS['rhel'], repo=value['repo'], reposet=value['reposet'], releasever=None, )) for value in repo_values ] for repo in repos: repo.sync() # step 4: Create content view content_view = entities.ContentView( organization=org, name=gen_string('alpha') ).create() # step 5: Associate repository to new content view content_view.repository = repos content_view = content_view.update(['repository']) # step 6: Publish content view and promote to lifecycle env. content_view.publish() content_view = content_view.read() promote(content_view.version[0], env.id) # step 7: Create activation key ak_name = gen_string('alpha') activation_key = entities.ActivationKey( name=ak_name, environment=env, organization=org, content_view=content_view, ).create() # step 7.1: Walk through the list of subscriptions. # Find the "Employee SKU" and attach it to the # recently-created activation key. for sub in entities.Subscription(organization=org).search(): if sub.read_json()['product_name'] == DEFAULT_SUBSCRIPTION_NAME: # 'quantity' must be 1, not subscription['quantity']. Greater # values produce this error: "RuntimeError: Error: Only pools # with multi-entitlement product subscriptions can be added to # the activation key with a quantity greater than one." activation_key.add_subscriptions(data={ 'quantity': 1, 'subscription_id': sub.id, }) break for content_label in [REPOS['rhst6']['id'], REPOS['rhst7']['id']]: # step 7.2: Enable product content activation_key.content_override(data={'content_override': { u'content_label': content_label, u'value': u'1', }}) return { 'org_name': org.name, 'cv_name': content_view.name, 'sat6_hostname': settings.server.hostname, 'ak_name': ak_name, 'env_name': env.name, }