From 63f993de77f685cbd56f35d63203b816fa88a331 Mon Sep 17 00:00:00 2001 From: cloudguruab Date: Wed, 18 Oct 2023 17:36:51 +0200 Subject: [PATCH] dev: fix to osm_port removal --- os_migrate/plugins/module_utils/workload_common.py | 2 +- os_migrate/plugins/modules/os_conversion_host_info.py | 2 +- tests/e2e/tasks/tenant/clean_pre_workload.yml | 4 ++-- tests/e2e/tasks/tenant/seed_workload.yml | 4 +++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/os_migrate/plugins/module_utils/workload_common.py b/os_migrate/plugins/module_utils/workload_common.py index c841d5af5..9539a9d37 100644 --- a/os_migrate/plugins/module_utils/workload_common.py +++ b/os_migrate/plugins/module_utils/workload_common.py @@ -163,7 +163,7 @@ def _converter_address(self): if self.conversion_host_address: return self.conversion_host_address else: - return self._converter().accessIPv4 + return self._converter().access_ipv4 def _update_progress(self, dev_path, progress): self.log.info('Transfer progress for %s: %s%%', dev_path, str(progress)) diff --git a/os_migrate/plugins/modules/os_conversion_host_info.py b/os_migrate/plugins/modules/os_conversion_host_info.py index 095968b02..f804762dd 100644 --- a/os_migrate/plugins/modules/os_conversion_host_info.py +++ b/os_migrate/plugins/modules/os_conversion_host_info.py @@ -131,7 +131,7 @@ def main(): # There are two possible attributes for the server's IPv4 floating IP # value, accessIPv4 and public_v4 which might not be consistent across # vendors, so we check both. - if hasattr(server, 'accessIPv4') and server.accessIPv4 != "": + if hasattr(server, 'access_ipv4') and server.access_ipv4 != "": conversion_host['address'] = server.accessIPv4 elif hasattr(server, 'public_v4') and server.public_v4 != "": conversion_host['address'] = server.public_v4 diff --git a/tests/e2e/tasks/tenant/clean_pre_workload.yml b/tests/e2e/tasks/tenant/clean_pre_workload.yml index c6165c30b..31d116618 100644 --- a/tests/e2e/tasks/tenant/clean_pre_workload.yml +++ b/tests/e2e/tasks/tenant/clean_pre_workload.yml @@ -98,7 +98,7 @@ - name: remove osm_ports ansible.builtin.include_tasks: check_pre_workload_ports.yml - when: networks_list.networks.keys() | length != 0 + when: "'networks' in networks_list" - name: remove osm_subnet openstack.cloud.subnet: @@ -186,4 +186,4 @@ - name: remove osm_security_group_rule ansible.builtin.include_tasks: check_pre_workload_security_group.yml - when: security_group_list.security_group | length != 0 + when: "'security_groups' in security_group_list" diff --git a/tests/e2e/tasks/tenant/seed_workload.yml b/tests/e2e/tasks/tenant/seed_workload.yml index c74466b0e..04e8bc6ff 100644 --- a/tests/e2e/tasks/tenant/seed_workload.yml +++ b/tests/e2e/tasks/tenant/seed_workload.yml @@ -5,7 +5,7 @@ - name: Create osm_volume ansible.builtin.command: - cmd: openstack volume create --size 1 --display-name osm_volume + cmd: openstack volume create --size 1 osm_volume environment: OS_AUTH_TYPE: token OS_AUTH_URL: "{{ os_migrate_src_auth.auth_url }}" @@ -14,6 +14,8 @@ OS_PROJECT_NAME: "{{ os_migrate_src_auth.project_name|default('') }}" OS_PROJECT_DOMAIN_ID: "{{ os_migrate_src_auth.project_domain_id|default('') }}" OS_PROJECT_DOMAIN_NAME: "{{ os_migrate_src_auth.project_domain_name|default('') }}" + register: _result + changed_when: "_result.rc == 0" - name: Create osm_server openstack.cloud.server: