def test_positive_deploy_configure_by_script(self, form_data, virtwho_config): """ Verify " hammer virt-who-config fetch" :id: ef0f1e33-7084-4d0e-95f1-d3080dfbb4cc :expectedresults: Config can be created, fetch and deploy :CaseLevel: Integration :CaseImportance: High """ assert virtwho_config['status'] == 'No Report Yet' script = VirtWhoConfig.fetch({'id': virtwho_config['id']}, output_format='base') hypervisor_name, guest_name = deploy_configure_by_script(script, debug=True) virt_who_instance = VirtWhoConfig.info({'id': virtwho_config['id']})[ 'general-information' ]['status'] assert virt_who_instance == 'OK' hosts = [ (hypervisor_name, f'product_id={settings.virtwho.sku_vdc_physical} and type=NORMAL'), (guest_name, f'product_id={settings.virtwho.sku_vdc_physical} and type=STACK_DERIVED'), ] for hostname, sku in hosts: host = Host.list({'search': hostname})[0] subscriptions = Subscription.list({'organization': DEFAULT_ORG, 'search': sku}) vdc_id = subscriptions[0]['id'] if 'type=STACK_DERIVED' in sku: for item in subscriptions: if hypervisor_name.lower() in item['type']: vdc_id = item['id'] break result = Host.subscription_attach({'host-id': host['id'], 'subscription-id': vdc_id}) assert 'attached to the host successfully' in '\n'.join(result) VirtWhoConfig.delete({'name': virtwho_config['name']}) assert not VirtWhoConfig.exists(search=('name', form_data['name']))
def test_positive_deploy_configure_by_id(self, form_data, virtwho_config): """ Verify " hammer virt-who-config deploy" :id: 19ffe76e-7e3d-48c7-b846-10a83afe0f3e :expectedresults: Config can be created and deployed :CaseLevel: Integration :CaseImportance: High """ assert virtwho_config['status'] == 'No Report Yet' command = get_configure_command(virtwho_config['id']) hypervisor_name, guest_name = deploy_configure_by_command(command, debug=True) virt_who_instance = VirtWhoConfig.info({'id': virtwho_config['id']})[ 'general-information' ]['status'] assert virt_who_instance == 'OK' hosts = [ (hypervisor_name, f'product_id={settings.virtwho.sku_vdc_physical} and type=NORMAL'), (guest_name, f'product_id={settings.virtwho.sku_vdc_physical} and type=STACK_DERIVED'), ] for hostname, sku in hosts: host = Host.list({'search': hostname})[0] subscriptions = Subscription.list({'organization': DEFAULT_ORG, 'search': sku}) vdc_id = subscriptions[0]['id'] if 'type=STACK_DERIVED' in sku: for item in subscriptions: if hypervisor_name.lower() in item['type']: vdc_id = item['id'] break result = Host.subscription_attach({'host-id': host['id'], 'subscription-id': vdc_id}) assert 'attached to the host successfully' in '\n'.join(result) VirtWhoConfig.delete({'name': virtwho_config['name']}) assert not VirtWhoConfig.exists(search=('name', form_data['name']))
def test_positive_list_affected_chosts(module_org, errata_hosts): """View a list of affected content hosts for an erratum. :id: 3b592253-52c0-4165-9a48-ba55287e9ee9 :Setup: Errata synced on satellite server, custom package installed on errata hosts. :Steps: host list --search 'applicable_errata = <erratum_id>' --organization-id=<org_id> :expectedresults: List of affected content hosts for an erratum is displayed. :CaseAutomation: Automated """ result = Host.list({ 'search': f'applicable_errata = {REPO_WITH_ERRATA["errata"][0]["id"]}', 'organization-id': module_org.id, 'fields': 'Name', }) reported_hostnames = {item['name'] for item in result} hostnames = {host.hostname for host in errata_hosts} assert hostnames.issubset( reported_hostnames ), 'One or more hostnames not found in list of applicable hosts'
def test_positive_auto_attach_disabled_golden_ticket( module_org, golden_ticket_host_setup, rhel7_contenthost_class, default_sat ): """Verify that Auto-Attach is disabled or "Not Applicable" when a host organization is in Simple Content Access mode (Golden Ticket) :id: 668fae4d-7364-4167-967f-6fc31ba52d26 :expectedresults: auto attaching a subscription is not allowed and returns an error message :customerscenario: true :BZ: 1718954 :CaseImportance: Medium """ rhel7_contenthost_class.install_katello_ca(default_sat) rhel7_contenthost_class.register_contenthost(module_org.label, golden_ticket_host_setup['name']) assert rhel7_contenthost_class.subscribed host = Host.list({'search': rhel7_contenthost_class.hostname}) host_id = host[0]['id'] with pytest.raises(CLIReturnCodeError) as context: Host.subscription_auto_attach({'host-id': host_id}) assert "This host's organization is in Simple Content Access mode" in str(context.value)
def test_positive_deploy_configure_by_script(self, default_org, form_data, virtwho_config): """Verify "GET /foreman_virt_who_configure/api/ v2/configs/:id/deploy_script" :id: 9668b900-0d2f-42ae-b2f8-523ca292b2bd :expectedresults: Config can be created and deployed :CaseLevel: Integration :CaseImportance: High """ assert virtwho_config.status == 'unknown' script = virtwho_config.deploy_script() hypervisor_name, guest_name = deploy_configure_by_script( script['virt_who_config_script'], form_data['hypervisor_type'], debug=True, org=default_org.label, ) virt_who_instance = (entities.VirtWhoConfig().search( query={'search': f'name={virtwho_config.name}'})[0].status) assert virt_who_instance == 'ok' hosts = [ ( hypervisor_name, f'product_id={settings.virtwho.sku.vdc_physical} and type=NORMAL', ), ( guest_name, f'product_id={settings.virtwho.sku.vdc_physical} and type=STACK_DERIVED', ), ] for hostname, sku in hosts: host = Host.list({'search': hostname})[0] subscriptions = Subscription.list({ 'organization': default_org.name, 'search': sku }) vdc_id = subscriptions[0]['id'] if 'type=STACK_DERIVED' in sku: for item in subscriptions: if hypervisor_name.lower() in item['type']: vdc_id = item['id'] break entities.HostSubscription(host=host['id']).add_subscriptions( data={'subscriptions': [{ 'id': vdc_id, 'quantity': 1 }]}) result = entities.Host().search( query={'search': hostname})[0].read_json() assert result['subscription_status_label'] == 'Fully entitled' virtwho_config.delete() assert not entities.VirtWhoConfig().search( query={'search': f"name={form_data['name']}"})
def test_positive_deploy_configure_by_script(self, default_org, form_data, virtwho_config): """Verify " hammer virt-who-config fetch" :id: 6aaffaeb-aaf2-42cf-b0dc-ca41a53d42a6 :expectedresults: Config can be created, fetch and deploy :CaseLevel: Integration :CaseImportance: High """ assert virtwho_config['status'] == 'No Report Yet' script = VirtWhoConfig.fetch({'id': virtwho_config['id']}, output_format='base') hypervisor_name, guest_name = deploy_configure_by_script( script, form_data['hypervisor-type'], debug=True, org=default_org.label) virt_who_instance = VirtWhoConfig.info( {'id': virtwho_config['id']})['general-information']['status'] assert virt_who_instance == 'OK' hosts = [ ( hypervisor_name, f'product_id={settings.virtwho.sku.vdc_physical} and type=NORMAL', ), ( guest_name, f'product_id={settings.virtwho.sku.vdc_physical} and type=STACK_DERIVED', ), ] for hostname, sku in hosts: host = Host.list({'search': hostname})[0] subscriptions = Subscription.list({ 'organization': default_org.name, 'search': sku }) vdc_id = subscriptions[0]['id'] if 'type=STACK_DERIVED' in sku: for item in subscriptions: if hypervisor_name.lower() in item['type']: vdc_id = item['id'] break result = Host.subscription_attach({ 'host-id': host['id'], 'subscription-id': vdc_id }) assert result.strip( ) == 'Subscription attached to the host successfully.' VirtWhoConfig.delete({'name': virtwho_config['name']}) assert not VirtWhoConfig.exists(search=('name', form_data['name']))
def test_positive_deploy_configure_by_id(self, form_data, virtwho_config): """Verify "POST /foreman_virt_who_configure/api/v2/configs" :id: 72d74c05-2580-4f38-b6c0-999ff470d4d6 :expectedresults: Config can be created and deployed :CaseLevel: Integration :CaseImportance: High """ assert virtwho_config.status == 'unknown' command = get_configure_command(virtwho_config.id) hypervisor_name, guest_name = deploy_configure_by_command( command, form_data['hypervisor_type'], debug=True) virt_who_instance = (entities.VirtWhoConfig().search( query={'search': f'name={virtwho_config.name}'})[0].status) assert virt_who_instance == 'ok' hosts = [ ( hypervisor_name, f'product_id={settings.virtwho.sku.vdc_physical} and type=NORMAL', ), ( guest_name, f'product_id={settings.virtwho.sku.vdc_physical} and type=STACK_DERIVED', ), ] for hostname, sku in hosts: host = Host.list({'search': hostname})[0] subscriptions = Subscription.list({ 'organization': DEFAULT_ORG, 'search': sku }) vdc_id = subscriptions[0]['id'] if 'type=STACK_DERIVED' in sku: for item in subscriptions: if hypervisor_name.lower() in item['type']: vdc_id = item['id'] break entities.HostSubscription(host=host['id']).add_subscriptions( data={'subscriptions': [{ 'id': vdc_id, 'quantity': 1 }]}) result = entities.Host().search( query={'search': hostname})[0].read_json() assert result['subscription_status_label'] == 'Fully entitled' virtwho_config.delete() assert not entities.VirtWhoConfig().search( query={'search': f"name={form_data['name']}"})
def deploy_validation(hypervisor_type): """Checkout the deploy result :param str hypervisor_type: esx, libvirt, rhevm, xen, libvirt, kubevirt, ahv :raises: VirtWhoError: If failed to start virt-who servcie. :ruturn: hypervisor_name and guest_name """ status = get_virtwho_status() if status != 'running': raise VirtWhoError("Failed to start virt-who service") hypervisor_name, guest_name = _get_hypervisor_mapping(hypervisor_type) for host in Host.list({'search': hypervisor_name}): Host.delete({'id': host['id']}) restart_virtwho_service() return hypervisor_name, guest_name
def deploy_validation(): """Checkout the deploy result :raises: VirtWhoError: If failed to start virt-who servcie. :ruturn: hypervisor_name and guest_name """ status = get_virtwho_status() if status != 'running': raise VirtWhoError("Failed to start virt-who service") _, logs = runcmd('cat /var/log/rhsm/rhsm.log') hypervisor_name, guest_name = _get_hypervisor_mapping(logs) for host in Host.list({'search': hypervisor_name}): Host.delete({'id': host['id']}) restart_virtwho_service() return hypervisor_name, guest_name
def test_positive_deploy_configure_by_id(self, default_org, form_data, virtwho_config): """Verify " hammer virt-who-config deploy" :id: e66bf88a-bd4e-409a-91a8-bc5e005d95dd :expectedresults: Config can be created and deployed :CaseLevel: Integration :CaseImportance: High """ assert virtwho_config['status'] == 'No Report Yet' command = get_configure_command(virtwho_config['id'], default_org.name) hypervisor_name, guest_name = deploy_configure_by_command( command, form_data['hypervisor-type'], debug=True, org=default_org.label) virt_who_instance = VirtWhoConfig.info( {'id': virtwho_config['id']})['general-information']['status'] assert virt_who_instance == 'OK' hosts = [ (hypervisor_name, f'product_id={settings.virtwho.sku.vdc_physical} and type=NORMAL' ), (guest_name, f'product_id={settings.virtwho.sku.vdc_physical} and type=STACK_DERIVED' ), ] for hostname, sku in hosts: host = Host.list({'search': hostname})[0] subscriptions = Subscription.list({ 'organization': default_org.name, 'search': sku }) vdc_id = subscriptions[0]['id'] if 'type=STACK_DERIVED' in sku: for item in subscriptions: if hypervisor_name.lower() in item['type']: vdc_id = item['id'] break result = Host.subscription_attach({ 'host-id': host['id'], 'subscription-id': vdc_id }) assert result.strip( ) == 'Subscription attached to the host successfully.' VirtWhoConfig.delete({'name': virtwho_config['name']}) assert not VirtWhoConfig.exists(search=('name', form_data['name']))
def test_positive_deploy_configure_by_id(self): """ Verify " hammer virt-who-config deploy" :id: 19ffe76e-7e3d-48c7-b846-10a83afe0f3e :expectedresults: Config can be created and deployed :CaseLevel: Integration :CaseImportance: High """ name = gen_string('alpha') args = self._make_virtwho_configure() args.update({'name': name}) vhd = VirtWhoConfig.create(args)['general-information'] self.assertEqual(vhd['status'], 'No Report Yet') command = get_configure_command(vhd['id']) hypervisor_name, guest_name = deploy_configure_by_command(command, debug=True) self.assertEqual( VirtWhoConfig.info({'id': vhd['id']})['general-information']['status'], 'OK') hosts = [ (hypervisor_name, 'product_id={} and type=NORMAL'.format(self.vdc_physical)), (guest_name, 'product_id={} and type=STACK_DERIVED'.format(self.vdc_physical)) ] for hostname, sku in hosts: host = Host.list({'search': hostname})[0] subscriptions = Subscription.list({ 'organization': DEFAULT_ORG, 'search': sku, }) vdc_id = subscriptions[0]['id'] if 'type=STACK_DERIVED' in sku: for item in subscriptions: if hypervisor_name.lower() in item['type']: vdc_id = item['id'] break result = Host.subscription_attach({ 'host-id': host['id'], 'subscription-id': vdc_id }) self.assertTrue( 'attached to the host successfully' in '\n'.join(result)) VirtWhoConfig.delete({'name': name}) self.assertFalse(VirtWhoConfig.exists(search=('name', name)))
def test_positive_associate_scap_policy_with_single_server(self): """Assign an audit policy to a single server :id: 30566c27-f466-4b4d-beaf-0a5bfda98b89 :setup: 1. Oscap should be enabled. 2. Oscap-cli hammer plugin installed. 3. At least 1 policy and host. :steps: 1. Login to hammer shell. 2. Execute "policy" command with "update" as sub-command. 3. Pass host name as the parameter. :expectedresults: The scap policy is updated. """ host = entities.Host() host.create() name = gen_string('alpha') scap_policy = make_scap_policy({ 'name': name, 'deploy-by': 'puppet', 'scap-content-id': self.scap_id_rhel6, 'scap-content-profile-id': self.scap_profile_id_rhel6, 'period': OSCAP_PERIOD['weekly'].lower(), 'weekday': OSCAP_WEEKDAY['friday'].lower() }) host_name = host.name + "." + host.domain.name Scappolicy.update({ 'id': scap_policy['id'], 'hosts': host_name, }) hosts = Host.list( {'search': 'compliance_policy_id = {0}'.format(scap_policy['id'])}) self.assertIn(host_name, [host['name'] for host in hosts], 'The attached host is different')
def deploy_configure_by_command(command, hypervisor_type, debug=False, org='Default_Organization'): """Deploy and run virt-who servcie by the hammer command. :param str command: get the command by UI/CLI/API, it should be like: `hammer virt-who-config deploy --id 1 --organization-id 1` :param str hypervisor_type: esx, libvirt, rhevm, xen, libvirt, kubevirt, ahv :param bool debug: if VIRTWHO_DEBUG=1, this option should be True. :param str org: Organization Label """ virtwho_cleanup() guest_name, guest_uuid = get_guest_info(hypervisor_type) if Host.list({'search': guest_name}): Host.delete({'name': guest_name}) register_system(get_system(hypervisor_type), org=org) ret, stdout = runcmd(command) if ret != 0 or 'Finished successfully' not in stdout: raise VirtWhoError(f"Failed to deploy configure by {command}") if debug: return deploy_validation(hypervisor_type)
def test_positive_auto_attach_disabled_golden_ticket(self): """Verify that Auto-Attach is disabled or "Not Applicable" when a host organization is in Simple Content Access mode (Golden Ticket) :id: 668fae4d-7364-4167-967f-6fc31ba52d26 :expectedresults: auto attaching a subscription is not allowed and returns an error message :BZ: 1718954 :CaseImportance: Medium """ with VirtualMachine(distro=DISTRO_RHEL7) as vm: vm.install_katello_ca() vm.register_contenthost(self.org_setup['label'], self.ak_setup['name']) assert vm.subscribed host = Host.list({'search': vm.hostname}) host_id = host[0]['id'] with pytest.raises(CLIReturnCodeError) as context: Host.subscription_auto_attach({'host-id': host_id}) assert 'Auto-attach is disabled' in str(context.value)
def test_positive_associate_scap_policy_with_single_server(self): """Assign an audit policy to a single server :id: 30566c27-f466-4b4d-beaf-0a5bfda98b89 :setup: 1. Oscap should be enabled. 2. Oscap-cli hammer plugin installed. 3. At least 1 policy and host. :steps: 1. Login to hammer shell. 2. Execute "policy" command with "update" as sub-command. 3. Pass host name as the parameter. :expectedresults: The scap policy is updated. """ host = entities.Host() host.create() name = gen_string('alpha') scap_policy = make_scap_policy({ 'name': name, 'scap-content-id': self.scap_id_rhel6, 'scap-content-profile-id': self.scap_profile_id_rhel6, 'period': OSCAP_PERIOD['weekly'].lower(), 'weekday': OSCAP_WEEKDAY['friday'].lower() }) host_name = host.name + "." + host.domain.name Scappolicy.update({ 'id': scap_policy['id'], 'hosts': host_name, }) hosts = Host.list({'search': 'compliance_policy_id = {0}'.format( scap_policy['id'])}) self.assertIn(host_name, [host['name'] for host in hosts], 'The attached host is different')
def tearDown(self, provisioning): """Delete the hosts to free the resources""" hosts = Host.list({'organization': provisioning.org_name}) for host in hosts: Host.delete({'id': host['id']})
def test_pre_create_virt_who_configuration(self, form_data): """Create and deploy virt-who configuration. :id: preupgrade-a36cbe89-47a2-422f-9881-0f86bea0e24e :steps: In Preupgrade Satellite, Create and deploy virt-who configuration. :expectedresults: 1. Config can be created and deployed by command. 2. No error msg in /var/log/rhsm/rhsm.log. 3. Report is sent to satellite. 4. Virtual sku can be generated and attached. """ default_loc_id = entities.Location().search( query={'search': f'name="{DEFAULT_LOC}"'})[0].id default_loc = entities.Location(id=default_loc_id).read() org = entities.Organization(name=ORG_DATA['name']).create() default_loc.organization.append(entities.Organization(id=org.id)) default_loc.update(['organization']) with manifests.clone() as manifest: upload_manifest(org.id, manifest.content) form_data.update({'organization_id': org.id}) vhd = entities.VirtWhoConfig(**form_data).create() assert vhd.status == 'unknown' command = get_configure_command(vhd.id, org=org.name) hypervisor_name, guest_name = deploy_configure_by_command( command, form_data['hypervisor_type'], debug=True, org=org.label) virt_who_instance = (entities.VirtWhoConfig( organization_id=org.id).search( query={'search': f'name={form_data["name"]}'})[0].status) assert virt_who_instance == 'ok' hosts = [ (hypervisor_name, f'product_id={settings.virtwho.sku.vdc_physical} and type=NORMAL' ), (guest_name, f'product_id={settings.virtwho.sku.vdc_physical} and type=STACK_DERIVED' ), ] for hostname, sku in hosts: host = Host.list({'search': hostname})[0] subscriptions = Subscription.list({ 'organization-id': org.id, 'search': sku }) vdc_id = subscriptions[0]['id'] if 'type=STACK_DERIVED' in sku: for item in subscriptions: if hypervisor_name.lower() in item['type']: vdc_id = item['id'] break entities.HostSubscription(host=host['id']).add_subscriptions( data={'subscriptions': [{ 'id': vdc_id, 'quantity': 1 }]}) result = (entities.Host(organization=org.id).search( query={'search': hostname})[0].read_json()) assert result['subscription_status_label'] == 'Fully entitled' scenario_dict = { self.__class__.__name__: { 'hypervisor_name': hypervisor_name, 'guest_name': guest_name, } } create_dict(scenario_dict)
def test_host_errata_search_commands(request, module_org, module_cv, module_lce, host_collection, errata_hosts): """View a list of affected hosts for security (RHSA) and bugfix (RHBA) errata, filtered with errata status and applicable flags. Applicability is calculated using the Library, but Installability is calculated using the attached CV, and is subject to the CV's own filtering. :id: 07757a77-7ab4-4020-99af-2beceb023266 :Setup: Errata synced on satellite server, custom package installed on errata hosts. :Steps: 1. host list --search 'errata_status = errata_needed' 2. host list --search 'errata_status = security_needed' 3. host list --search 'applicable_errata = <bugfix_advisory>' 4. host list --search 'applicable_errata = <security_advisory>' 5. host list --search 'applicable_rpms = <bugfix_package>' 6. host list --search 'applicable_rpms = <security_package>' 7. Create filter & rule to hide RPM (applicable vs. installable test) 8. Repeat steps 3 and 5, but 5 expects host name not found. :expectedresults: The hosts are correctly listed for security and bugfix advisories. """ # note time for later wait_for_tasks include 2 mins margin of safety. timestamp = (datetime.utcnow() - timedelta(minutes=2)).strftime('%Y-%m-%d %H:%M') errata = REPO_WITH_ERRATA['errata'] # Update package on first host so that the security advisory doesn't apply. result = errata_hosts[0].execute( f'yum update -y {errata[0]["new_package"]}') assert result.status == 0, 'Failed to install rpm' # Update package on second host so that the bugfix advisory doesn't apply. result = errata_hosts[1].execute( f'yum update -y {errata[1]["new_package"]}') assert result.status == 0, 'Failed to install rpm' # Wait for upload profile event (in case Satellite system slow) host = entities.Host().search( query={'search': f'name={errata_hosts[0].hostname}'}) wait_for_tasks( search_query=('label = Actions::Katello::Host::UploadProfiles' f' and resource_id = {host[0].id}' f' and started_at >= "{timestamp}"'), search_rate=15, max_tries=10, ) # Step 1: Search for hosts that require bugfix advisories result = Host.list({ 'search': 'errata_status = errata_needed', 'organization-id': module_org.id, 'per-page': PER_PAGE_LARGE, }) result = [item['name'] for item in result] assert errata_hosts[0].hostname in result assert errata_hosts[1].hostname not in result # Step 2: Search for hosts that require security advisories result = Host.list({ 'search': 'errata_status = security_needed', 'organization-id': module_org.id, 'per-page': PER_PAGE_LARGE, }) result = [item['name'] for item in result] assert errata_hosts[0].hostname not in result assert errata_hosts[1].hostname in result # Step 3: Search for hosts that require the specified bugfix advisory result = Host.list({ 'search': f'applicable_errata = {errata[1]["id"]}', 'organization-id': module_org.id, 'per-page': PER_PAGE_LARGE, }) result = [item['name'] for item in result] assert errata_hosts[0].hostname in result assert errata_hosts[1].hostname not in result # Step 4: Search for hosts that require the specified security advisory result = Host.list({ 'search': f'applicable_errata = {errata[0]["id"]}', 'organization-id': module_org.id, 'per-page': PER_PAGE_LARGE, }) result = [item['name'] for item in result] assert errata_hosts[0].hostname not in result assert errata_hosts[1].hostname in result # Step 5: Search for hosts that require the specified bugfix package result = Host.list({ 'search': f'applicable_rpms = {errata[1]["new_package"]}', 'organization-id': module_org.id, 'per-page': PER_PAGE_LARGE, }) result = [item['name'] for item in result] assert errata_hosts[0].hostname in result assert errata_hosts[1].hostname not in result # Step 6: Search for hosts that require the specified security package result = Host.list({ 'search': f'applicable_rpms = {errata[0]["new_package"]}', 'organization-id': module_org.id, 'per-page': PER_PAGE_LARGE, }) result = [item['name'] for item in result] assert errata_hosts[0].hostname not in result assert errata_hosts[1].hostname in result # Step 7: Apply filter and rule to CV to hide RPM, thus making erratum not installable # Make RPM exclude filter cv_filter = make_content_view_filter({ 'content-view-id': module_cv.id, 'name': 'erratum_search_test', 'description': 'Hide the installable errata', 'organization-id': module_org.id, 'type': 'rpm', 'inclusion': 'false', }) @request.addfinalizer def cleanup(): cv_filter_cleanup(cv_filter['filter-id'], module_cv, module_org, module_lce) # Make rule to exclude the specified bugfix package make_content_view_filter_rule({ 'content-view-id': module_cv.id, 'content-view-filter-id': cv_filter['filter-id'], 'name': errata[1]['package_name'], }) # Publish and promote a new version with the filter cv_publish_promote(module_cv, module_org, module_lce) # Step 8: Run tests again. Applicable should still be true, installable should now be false. # Search for hosts that require the bugfix package. result = Host.list({ 'search': f'applicable_rpms = {errata[1]["new_package"]}', 'organization-id': module_org.id, 'per-page': PER_PAGE_LARGE, }) result = [item['name'] for item in result] assert errata_hosts[0].hostname in result assert errata_hosts[1].hostname not in result # Search for hosts that require the specified bugfix advisory. result = Host.list({ 'search': f'installable_errata = {errata[1]["id"]}', 'organization-id': module_org.id, 'per-page': PER_PAGE_LARGE, }) result = [item['name'] for item in result] assert errata_hosts[0].hostname not in result assert errata_hosts[1].hostname not in result
def tearDown(self): """Delete the host to free the resources""" super(ComputeResourceHostTestCase, self).tearDown() hosts = Host.list({'organization': self.org_name}) for host in hosts: Host.delete({'id': host['id']})
def tearDown(self): """Delete the host to free the resources""" super().tearDown() hosts = Host.list({'organization': self.org_name}) for host in hosts: Host.delete({'id': host['id']})