From e0c46060ddc528b799adc1370f31da6488476fcb Mon Sep 17 00:00:00 2001 From: yanpliu Date: Thu, 7 Mar 2024 01:19:54 -0500 Subject: [PATCH 01/13] codecoverage bug2173870 --- robottelo/utils/virtwho.py | 72 ++++++++++++++++++ tests/foreman/virtwho/cli/test_esx_sca.py | 90 +++++++++++++++++++++++ 2 files changed, 162 insertions(+) diff --git a/robottelo/utils/virtwho.py b/robottelo/utils/virtwho.py index 5e0f3a4657a..27968c4d37a 100644 --- a/robottelo/utils/virtwho.py +++ b/robottelo/utils/virtwho.py @@ -473,6 +473,33 @@ def hypervisor_json_create(hypervisors, guests): return mapping +def hypervisor_fake_json_create(hypervisors, guests): + """ + Create a hypervisor guest json data for fake config usages. For example: + {'hypervisors': [{'uuid': '820b5143-3885-4dba-9358-4ce8c30d934e', + 'guests': [{'guestId': 'afb91b1f-8438-46f5-bc67-d7ab328ef782', 'state': 1, + 'attributes': {'active': 1, 'virtWhoType': 'esx'}}]}]} + :param hypervisors: how many hypervisors will be created + :param guests: how many guests will be created + """ + hypervisors_list = [] + for _ in range(hypervisors): + guest_list = [] + for _ in range(guests): + guest_list.append( + { + "guestId": str(uuid.uuid4()), + "state": 1, + "attributes": {"active": 1, "virtWhoType": "esx"}, + } + ) + name = str(uuid.uuid4()) + hypervisor = {"guests": guest_list, "name": name, "uuid": name} + hypervisors_list.append(hypervisor) + mapping = {"hypervisors": hypervisors_list} + return mapping + + def create_fake_hypervisor_content(org_label, hypervisors, guests): """ Post the fake hypervisor content to satellite server @@ -541,3 +568,48 @@ def get_configure_command_option(deploy_type, args, org=DEFAULT_ORG): return f"hammer -u {username} -p {password} virt-who-config deploy --id {args['id']} --organization-title '{args['organization-title']}' " elif deploy_type == 'name': return f"hammer -u {username} -p {password} virt-who-config deploy --name {args['name']} --organization '{org}' " + + +def vw_fake_conf_create( + owner, + rhsm_hostname, + rhsm_username, + rhsm_encrypted_password, + fake_conf_file, + json_file, + is_hypervisor=True, +): + conf_name = fake_conf_file.split("/")[-1].split(".")[0] + file = f'{fake_conf_file}\n' + title = f'[{conf_name}]\n' + type = 'type=fake\n' + json = f'file={json_file}\n' + is_hypervisor = f'is_hypervisor={is_hypervisor}\n' + owner = f'owner={owner}\n' + env = 'env = Library\n' + rhsm_hostname = f'rhsm_hostname={rhsm_hostname}\n' + rhsm_username = f'rhsm_username={rhsm_username}\n' + rhsm_encrypted_password = f'rhsm_encrypted_password={rhsm_encrypted_password}\n' + rhsm_prefix = 'rhsm_prefix=/rhsm\n' + rhsm_port = 'rhsm_port=443\n' + cmd = ('cat < {}' '{}' '{}' '{}' '{}' '{}' '{}' '{}' '{}' '{}' '{}' '{}' 'EOF').format( + file, + title, + type, + json, + is_hypervisor, + owner, + env, + rhsm_hostname, + rhsm_username, + rhsm_encrypted_password, + rhsm_prefix, + rhsm_port, + ) + runcmd(cmd) + + +def vw_run_option(option): + runcmd("systemctl stop virt-who") + runcmd("pkill -9 virt-who") + runcmd(f"virt-who -{option}") diff --git a/tests/foreman/virtwho/cli/test_esx_sca.py b/tests/foreman/virtwho/cli/test_esx_sca.py index 6b15b6803f9..9f3fabe2033 100644 --- a/tests/foreman/virtwho/cli/test_esx_sca.py +++ b/tests/foreman/virtwho/cli/test_esx_sca.py @@ -9,6 +9,8 @@ :Team: Phoenix """ +import json +from pathlib import Path import re from fauxfactory import gen_string @@ -18,14 +20,18 @@ from robottelo.config import settings from robottelo.utils.virtwho import ( ETC_VIRTWHO_CONFIG, + check_message_in_rhsm_log, create_http_proxy, deploy_configure_by_command, deploy_configure_by_command_check, get_configure_command, get_configure_file, get_configure_option, + hypervisor_fake_json_create, hypervisor_json_create, virtwho_package_locked, + vw_fake_conf_create, + vw_run_option, ) @@ -502,3 +508,87 @@ def test_positive_remove_env_option( env_warning = f"Ignoring unknown configuration option \"{option}\"" result = target_sat.execute(f'grep "{env_warning}" /var/log/messages') assert result.status == 1 + + @pytest.mark.tier2 + def test_positive_post_hypervisors_with_fake_different_org_simultaneous( + self, module_sca_manifest_org, form_data_cli, target_sat + ): + """create many fake conf files in two orgs with specific service account rhsm_username=virt_who_reporter_X post to satellite without task errors" + + :id: ee2ec178-01e0-48b9-8c2f-5c3279eef796 + + :expectedresults: + hypervisor/guest json can be posted and the task is success status + + :customerscenario: true + + :CaseImportance: Medium + + :BZ: 2173870 + """ + + # create 3 hypersiors and each have 3 guests json file + json_file = Path("/tmp/fake.json") + data = hypervisor_fake_json_create(hypervisors=1, guests=1) + json_file.write_text(json.dumps(data)) + # create 10 fake files in module_sca_manifest_org + virtwho_config_cli = target_sat.cli.VirtWhoConfig.create(form_data_cli)[ + 'general-information' + ] + command = get_configure_command(virtwho_config_cli['id'], module_sca_manifest_org.name) + deploy_configure_by_command( + command, form_data_cli['hypervisor-type'], org=module_sca_manifest_org.label + ) + config_file_1 = get_configure_file(virtwho_config_cli['id']) + owner_1 = get_configure_option('owner', config_file_1) + rhsm_hostname_1 = get_configure_option('rhsm_hostname', config_file_1) + rhsm_username_1 = get_configure_option('rhsm_username', config_file_1) + rhsm_encrypted_password_1 = get_configure_option('rhsm_encrypted_password', config_file_1) + # create another org and create fake conf files in this org + ORG_DATA = {'name': f'virtwho_fake_{gen_string("alpha")}'} + org = target_sat.api.Organization(name=ORG_DATA['name']).create() + target_sat.api.Location(organization=[org]).create() + form_data_cli['organization-id'] = org.id + virtwho_config_cli = target_sat.cli.VirtWhoConfig.create(form_data_cli)[ + 'general-information' + ] + command = get_configure_command(virtwho_config_cli['id'], org.name) + deploy_configure_by_command( + command, form_data_cli['hypervisor-type'], debug=True, org=org.label + ) + config_file_2 = get_configure_file(virtwho_config_cli['id']) + owner_2 = get_configure_option('owner', config_file_2) + rhsm_hostname_2 = get_configure_option('rhsm_hostname', config_file_2) + rhsm_username_2 = get_configure_option('rhsm_username', config_file_2) + rhsm_encrypted_password_2 = get_configure_option('rhsm_encrypted_password', config_file_2) + for i in range(5): + fake_conf_file = f"/etc/virt-who.d/virt-who-config-fake{i}.conf" + vw_fake_conf_create( + owner_1, + rhsm_hostname_1, + rhsm_username_1, + rhsm_encrypted_password_1, + fake_conf_file, + json_file, + ) + for i in range(5, 10): + fake_conf_file = f"/etc/virt-who.d/virt-who-config-fake{i}.conf" + vw_fake_conf_create( + owner_2, + rhsm_hostname_2, + rhsm_username_2, + rhsm_encrypted_password_2, + fake_conf_file, + json_file, + ) + vw_run_option("od") + for i in range(10): + fake_conf_file = f"/etc/virt-who.d/virt-who-config-fake{i}.conf" + conf_name = fake_conf_file.split("/")[-1].split(".")[0] + config_str = f'Using configuration "{conf_name}" ("fake" mode)' + check_message_in_rhsm_log(config_str) + check_message_in_rhsm_log(f"Host-to-guest mapping being sent to '{org}'") + task = target_sat.cli.Task.list_tasks({'search': 'label ~ Hyper'}) + for item in task: + assert "Job blocked by the following existing jobs" not in item['task-errors'] + assert "success" in item['result'] From 5598f7562392c1a8f46c11bc07af45f06185589c Mon Sep 17 00:00:00 2001 From: yanpliu Date: Mon, 11 Mar 2024 03:55:57 -0400 Subject: [PATCH 02/13] update the code for f-format and comments --- robottelo/utils/virtwho.py | 15 +-------------- tests/foreman/virtwho/cli/test_esx_sca.py | 5 +++-- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/robottelo/utils/virtwho.py b/robottelo/utils/virtwho.py index 27968c4d37a..c20d39ff6db 100644 --- a/robottelo/utils/virtwho.py +++ b/robottelo/utils/virtwho.py @@ -592,20 +592,7 @@ def vw_fake_conf_create( rhsm_encrypted_password = f'rhsm_encrypted_password={rhsm_encrypted_password}\n' rhsm_prefix = 'rhsm_prefix=/rhsm\n' rhsm_port = 'rhsm_port=443\n' - cmd = ('cat < {}' '{}' '{}' '{}' '{}' '{}' '{}' '{}' '{}' '{}' '{}' '{}' 'EOF').format( - file, - title, - type, - json, - is_hypervisor, - owner, - env, - rhsm_hostname, - rhsm_username, - rhsm_encrypted_password, - rhsm_prefix, - rhsm_port, - ) + cmd = f'cat < {file}\n{title}\n{type}\n{json}\n{is_hypervisor}\n{owner}\n{env}\n{rhsm_hostname}\n{rhsm_username}\n{rhsm_encrypted_password}\n{rhsm_prefix}\n{rhsm_port}\nEOF' runcmd(cmd) diff --git a/tests/foreman/virtwho/cli/test_esx_sca.py b/tests/foreman/virtwho/cli/test_esx_sca.py index 9f3fabe2033..6b397d16946 100644 --- a/tests/foreman/virtwho/cli/test_esx_sca.py +++ b/tests/foreman/virtwho/cli/test_esx_sca.py @@ -527,9 +527,9 @@ def test_positive_post_hypervisors_with_fake_different_org_simultaneous( :BZ: 2173870 """ - # create 3 hypersiors and each have 3 guests json file + # create json file for 3 hyperviors, each with 3 guests json_file = Path("/tmp/fake.json") - data = hypervisor_fake_json_create(hypervisors=1, guests=1) + data = hypervisor_fake_json_create(hypervisors=3, guests=3) json_file.write_text(json.dumps(data)) # create 10 fake files in module_sca_manifest_org virtwho_config_cli = target_sat.cli.VirtWhoConfig.create(form_data_cli)[ @@ -581,6 +581,7 @@ def test_positive_post_hypervisors_with_fake_different_org_simultaneous( fake_conf_file, json_file, ) + # run virt-who with option -d, --debug and -o, --one-shot vw_run_option("od") for i in range(10): fake_conf_file = f"/etc/virt-who.d/virt-who-config-fake{i}.conf" From a74914111a0a395706a03ae8f0c9f2e0cb5a0988 Mon Sep 17 00:00:00 2001 From: yanpliu Date: Mon, 11 Mar 2024 21:31:54 -0400 Subject: [PATCH 03/13] fix conflict and format issue --- robottelo/utils/virtwho.py | 1 + 1 file changed, 1 insertion(+) diff --git a/robottelo/utils/virtwho.py b/robottelo/utils/virtwho.py index c20d39ff6db..915e2065bd0 100644 --- a/robottelo/utils/virtwho.py +++ b/robottelo/utils/virtwho.py @@ -568,6 +568,7 @@ def get_configure_command_option(deploy_type, args, org=DEFAULT_ORG): return f"hammer -u {username} -p {password} virt-who-config deploy --id {args['id']} --organization-title '{args['organization-title']}' " elif deploy_type == 'name': return f"hammer -u {username} -p {password} virt-who-config deploy --name {args['name']} --organization '{org}' " + return None def vw_fake_conf_create( From 28a63268c36a89dcb9c3bf5604d51560ef94937b Mon Sep 17 00:00:00 2001 From: yanpliu Date: Tue, 12 Mar 2024 00:41:45 -0400 Subject: [PATCH 04/13] update to fix conflict --- robottelo/utils/virtwho.py | 41 ++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/robottelo/utils/virtwho.py b/robottelo/utils/virtwho.py index 915e2065bd0..77b083c425c 100644 --- a/robottelo/utils/virtwho.py +++ b/robottelo/utils/virtwho.py @@ -47,16 +47,15 @@ def get_system(system_type): 'password': getattr(settings.virtwho, system_type).guest_password, 'port': getattr(settings.virtwho, system_type).guest_port, } - elif system_type == 'satellite': + if system_type == 'satellite': return { 'hostname': settings.server.hostname, 'username': settings.server.ssh_username, 'password': settings.server.ssh_password, } - else: - raise VirtWhoError( - f'"{system_type}" system type is not supported. Please use one of {system_type_list}' - ) + raise VirtWhoError( + f'"{system_type}" system type is not supported. Please use one of {system_type_list}' + ) def get_guest_info(hypervisor_type): @@ -115,8 +114,7 @@ def register_system(system, activation_key=None, org='Default_Organization', env ret, stdout = runcmd(cmd, system) if ret == 0 or "system has been registered" in stdout: return True - else: - raise VirtWhoError(f'Failed to register system: {system}') + raise VirtWhoError(f'Failed to register system: {system}') def virtwho_cleanup(): @@ -150,10 +148,9 @@ def get_virtwho_status(): return 'logerror' if any(key in stdout for key in running_stauts): return 'running' - elif any(key in stdout for key in stopped_status): + if any(key in stdout for key in stopped_status): return 'stopped' - else: - return 'undefined' + return 'undefined' def get_configure_id(name): @@ -164,8 +161,7 @@ def get_configure_id(name): config = VirtWhoConfig.info({'name': name}) if 'id' in config['general-information']: return config['general-information']['id'] - else: - raise VirtWhoError(f"No configure id found for {name}") + raise VirtWhoError(f"No configure id found for {name}") def get_configure_command(config_id, org=DEFAULT_ORG): @@ -198,10 +194,8 @@ def get_configure_option(option, filename): cmd = f"grep -v '^#' {filename} | grep ^{option}" ret, stdout = runcmd(cmd) if ret == 0 and option in stdout: - value = stdout.split('=')[1].strip() - return value - else: - raise VirtWhoError(f"option {option} is not exist or not be enabled in {filename}") + return stdout.split('=')[1].strip() + raise VirtWhoError(f"option {option} is not exist or not be enabled in {filename}") def get_rhsm_log(): @@ -264,8 +258,7 @@ def _get_hypervisor_mapping(hypervisor_type): break if hypervisor_name: return hypervisor_name, guest_name - else: - raise VirtWhoError(f"Failed to get the hypervisor_name for guest {guest_name}") + raise VirtWhoError(f"Failed to get the hypervisor_name for guest {guest_name}") def get_hypervisor_ahv_mapping(hypervisor_type): @@ -348,6 +341,7 @@ def deploy_configure_by_command(command, hypervisor_type, debug=False, org='Defa raise VirtWhoError(f"Failed to deploy configure by {command}") if debug: return deploy_validation(hypervisor_type) + return None def deploy_configure_by_script( @@ -371,6 +365,7 @@ def deploy_configure_by_script( raise VirtWhoError(f"Failed to deploy configure by {script_filename}") if debug: return deploy_validation(hypervisor_type) + return None def deploy_configure_by_command_check(command): @@ -389,8 +384,7 @@ def deploy_configure_by_command_check(command): else: if ret != 0 or 'Finished successfully' not in stdout: raise VirtWhoError(f"Failed to deploy configure by {command}") - else: - return 'Finished successfully' + return 'Finished successfully' def restart_virtwho_service(): @@ -469,8 +463,7 @@ def hypervisor_json_create(hypervisors, guests): name = str(uuid.uuid4()) hypervisor = {"guestIds": guest_list, "name": name, "hypervisorId": {"hypervisorId": name}} hypervisors_list.append(hypervisor) - mapping = {"hypervisors": hypervisors_list} - return mapping + return {"hypervisors": hypervisors_list} def hypervisor_fake_json_create(hypervisors, guests): @@ -564,9 +557,9 @@ def get_configure_command_option(deploy_type, args, org=DEFAULT_ORG): username, password = Base._get_username_password() if deploy_type == 'location-id': return f"hammer -u {username} -p {password} virt-who-config deploy --id {args['id']} --location-id '{args['location-id']}' " - elif deploy_type == 'organization-title': + if deploy_type == 'organization-title': return f"hammer -u {username} -p {password} virt-who-config deploy --id {args['id']} --organization-title '{args['organization-title']}' " - elif deploy_type == 'name': + if deploy_type == 'name': return f"hammer -u {username} -p {password} virt-who-config deploy --name {args['name']} --organization '{org}' " return None From a39d39bb3e3e9c8361e2711b4bba620be093926e Mon Sep 17 00:00:00 2001 From: yanpliu Date: Tue, 12 Mar 2024 00:46:49 -0400 Subject: [PATCH 05/13] update to fix conflict --- robottelo/utils/virtwho.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/robottelo/utils/virtwho.py b/robottelo/utils/virtwho.py index 77b083c425c..b8103717fc1 100644 --- a/robottelo/utils/virtwho.py +++ b/robottelo/utils/virtwho.py @@ -489,8 +489,7 @@ def hypervisor_fake_json_create(hypervisors, guests): name = str(uuid.uuid4()) hypervisor = {"guests": guest_list, "name": name, "uuid": name} hypervisors_list.append(hypervisor) - mapping = {"hypervisors": hypervisors_list} - return mapping + return {"hypervisors": hypervisors_list} def create_fake_hypervisor_content(org_label, hypervisors, guests): From d4173cdd65ffc03e51d1ebd8ae96bb9eb57773b2 Mon Sep 17 00:00:00 2001 From: yanpliu Date: Wed, 24 Apr 2024 23:33:09 -0400 Subject: [PATCH 06/13] use nested list comprehensions to replace loop --- robottelo/utils/virtwho.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/robottelo/utils/virtwho.py b/robottelo/utils/virtwho.py index b8103717fc1..32b0af99a7d 100644 --- a/robottelo/utils/virtwho.py +++ b/robottelo/utils/virtwho.py @@ -475,20 +475,21 @@ def hypervisor_fake_json_create(hypervisors, guests): :param hypervisors: how many hypervisors will be created :param guests: how many guests will be created """ - hypervisors_list = [] - for _ in range(hypervisors): - guest_list = [] - for _ in range(guests): - guest_list.append( + hypervisors_list = [ + { + 'guests': [ { "guestId": str(uuid.uuid4()), "state": 1, "attributes": {"active": 1, "virtWhoType": "esx"}, } - ) - name = str(uuid.uuid4()) - hypervisor = {"guests": guest_list, "name": name, "uuid": name} - hypervisors_list.append(hypervisor) + for _ in range(guests) + ], + 'name': str(uuid.uuid4()), + 'uuid': str(uuid.uuid4()), + } + for _ in range(hypervisors) + ] return {"hypervisors": hypervisors_list} From 84e9ff17dfd7f92108b5ed9e63ffafdf220304fb Mon Sep 17 00:00:00 2001 From: yanpliu Date: Fri, 26 Apr 2024 09:19:41 +0800 Subject: [PATCH 07/13] replace double quotes with single quotes --- robottelo/utils/virtwho.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/robottelo/utils/virtwho.py b/robottelo/utils/virtwho.py index d679cb88a5f..c7d2c923a19 100644 --- a/robottelo/utils/virtwho.py +++ b/robottelo/utils/virtwho.py @@ -591,6 +591,6 @@ def vw_fake_conf_create( def vw_run_option(option): - runcmd("systemctl stop virt-who") - runcmd("pkill -9 virt-who") - runcmd(f"virt-who -{option}") + runcmd('systemctl stop virt-who') + runcmd('pkill -9 virt-who') + runcmd(f'virt-who -{option}') From d0207c6329d345ffcd2e650eb9cd353dd0b04e34 Mon Sep 17 00:00:00 2001 From: yanpliu Date: Fri, 26 Apr 2024 09:45:27 +0800 Subject: [PATCH 08/13] remove the duplicated \n --- robottelo/utils/virtwho.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/robottelo/utils/virtwho.py b/robottelo/utils/virtwho.py index c7d2c923a19..5b20d557c1f 100644 --- a/robottelo/utils/virtwho.py +++ b/robottelo/utils/virtwho.py @@ -586,7 +586,7 @@ def vw_fake_conf_create( rhsm_encrypted_password = f'rhsm_encrypted_password={rhsm_encrypted_password}\n' rhsm_prefix = 'rhsm_prefix=/rhsm\n' rhsm_port = 'rhsm_port=443\n' - cmd = f'cat < {file}\n{title}\n{type}\n{json}\n{is_hypervisor}\n{owner}\n{env}\n{rhsm_hostname}\n{rhsm_username}\n{rhsm_encrypted_password}\n{rhsm_prefix}\n{rhsm_port}\nEOF' + cmd = f'cat < {file}{title}{type}{json}{is_hypervisor}{owner}{env}{rhsm_hostname}{rhsm_username}{rhsm_encrypted_password}{rhsm_prefix}{rhsm_port}EOF' runcmd(cmd) From 19f48129df97941dede394d4dba6ad75ad9fb7d6 Mon Sep 17 00:00:00 2001 From: yanpliu Date: Fri, 26 Apr 2024 09:55:51 +0800 Subject: [PATCH 09/13] Add the description of the methods --- robottelo/utils/virtwho.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/robottelo/utils/virtwho.py b/robottelo/utils/virtwho.py index 5b20d557c1f..0000572fdad 100644 --- a/robottelo/utils/virtwho.py +++ b/robottelo/utils/virtwho.py @@ -573,6 +573,16 @@ def vw_fake_conf_create( json_file, is_hypervisor=True, ): + """Create fake config file + :param owner: Name of the Owner + :param rhsm_hostname: Name of the rhsm_hostname + :param rhsm_username: Name of the rhsm_username + :param rhsm_encrypted_password: Value of the rhsm_encrypted_password + :param fake_conf_file: Name of the fake_conf_file + :param json_file: Name of the json_file + :param is_hypervisor: Default ir True + :ruturn: + """ conf_name = fake_conf_file.split("/")[-1].split(".")[0] file = f'{fake_conf_file}\n' title = f'[{conf_name}]\n' @@ -591,6 +601,16 @@ def vw_fake_conf_create( def vw_run_option(option): + """virt who run by option + :param option: + -d, --debug Enable debugging output + -o, --one-shot Send the list of guest IDs and exit immediately + -i INTERVAL, --interval INTERVAL + -p, --print + -c CONFIGS, --config CONFIGS + --version Display the version information + :ruturn: + """ runcmd('systemctl stop virt-who') runcmd('pkill -9 virt-who') runcmd(f'virt-who -{option}') From bbac11421093f159093aec5894bea22ea7e6097d Mon Sep 17 00:00:00 2001 From: yanpliu Date: Fri, 26 Apr 2024 17:04:17 +0800 Subject: [PATCH 10/13] Update the pre-commit for description --- robottelo/utils/virtwho.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/robottelo/utils/virtwho.py b/robottelo/utils/virtwho.py index 0000572fdad..b650dc75773 100644 --- a/robottelo/utils/virtwho.py +++ b/robottelo/utils/virtwho.py @@ -581,7 +581,7 @@ def vw_fake_conf_create( :param fake_conf_file: Name of the fake_conf_file :param json_file: Name of the json_file :param is_hypervisor: Default ir True - :ruturn: + :ruturn: """ conf_name = fake_conf_file.split("/")[-1].split(".")[0] file = f'{fake_conf_file}\n' @@ -602,14 +602,8 @@ def vw_fake_conf_create( def vw_run_option(option): """virt who run by option - :param option: - -d, --debug Enable debugging output - -o, --one-shot Send the list of guest IDs and exit immediately - -i INTERVAL, --interval INTERVAL - -p, --print - -c CONFIGS, --config CONFIGS - --version Display the version information - :ruturn: + :param option: -d, --debug -o, --one-shot -i INTERVAL, --interval INTERVAL -p, --print -c CONFIGS, --config CONFIGS --version + :ruturn: """ runcmd('systemctl stop virt-who') runcmd('pkill -9 virt-who') From 7b914fc958e8eb722b096a9a80634adf48060b25 Mon Sep 17 00:00:00 2001 From: yanpliu Date: Fri, 26 Apr 2024 18:59:40 +0800 Subject: [PATCH 11/13] Update robottelo/utils/virtwho.py Co-authored-by: Gaurav Talreja --- robottelo/utils/virtwho.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/robottelo/utils/virtwho.py b/robottelo/utils/virtwho.py index b650dc75773..2af8f292067 100644 --- a/robottelo/utils/virtwho.py +++ b/robottelo/utils/virtwho.py @@ -581,7 +581,7 @@ def vw_fake_conf_create( :param fake_conf_file: Name of the fake_conf_file :param json_file: Name of the json_file :param is_hypervisor: Default ir True - :ruturn: + :return: """ conf_name = fake_conf_file.split("/")[-1].split(".")[0] file = f'{fake_conf_file}\n' From 6e3c7ada34dc95b12303b29cdebd93abff92ce02 Mon Sep 17 00:00:00 2001 From: yanpliu Date: Thu, 16 May 2024 12:13:20 +0800 Subject: [PATCH 12/13] resolve conflict --- tests/foreman/virtwho/cli/test_esx_sca.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/foreman/virtwho/cli/test_esx_sca.py b/tests/foreman/virtwho/cli/test_esx_sca.py index b3b5ce17101..5a9619931c4 100644 --- a/tests/foreman/virtwho/cli/test_esx_sca.py +++ b/tests/foreman/virtwho/cli/test_esx_sca.py @@ -682,3 +682,4 @@ def test_positive_post_hypervisors_with_fake_different_org_simultaneous( for item in task: assert "Job blocked by the following existing jobs" not in item['task-errors'] assert "success" in item['result'] + From 539b0d0110092590cc14cd2bd26718630dc24bd0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 16 May 2024 04:15:56 +0000 Subject: [PATCH 13/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/foreman/virtwho/cli/test_esx_sca.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/foreman/virtwho/cli/test_esx_sca.py b/tests/foreman/virtwho/cli/test_esx_sca.py index 5a9619931c4..ba4e5b9238d 100644 --- a/tests/foreman/virtwho/cli/test_esx_sca.py +++ b/tests/foreman/virtwho/cli/test_esx_sca.py @@ -9,6 +9,7 @@ :Team: Phoenix """ + import json from pathlib import Path import re @@ -682,4 +683,3 @@ def test_positive_post_hypervisors_with_fake_different_org_simultaneous( for item in task: assert "Job blocked by the following existing jobs" not in item['task-errors'] assert "success" in item['result'] -