diff --git a/plugins/module_utils/v4/iam/helpers.py b/plugins/module_utils/v4/iam/helpers.py index a7d4fc55..737cf55d 100644 --- a/plugins/module_utils/v4/iam/helpers.py +++ b/plugins/module_utils/v4/iam/helpers.py @@ -6,6 +6,15 @@ def get_authorization_policy(module, api_instance, ext_id): + """ + This method will return authorization policy info using ext_id. + Args: + module (object): Ansible module object + api_instance (object): Authorization policy api instance + ext_id (str): External id of authorization policy + Returns: + authorization_policy_info (dict): Authorization policy info + """ try: return api_instance.get_authorization_policy_by_id(extId=ext_id).data except Exception as e: diff --git a/plugins/module_utils/v4/vmm/helpers.py b/plugins/module_utils/v4/vmm/helpers.py index 8f8f7c1d..f6ae3240 100644 --- a/plugins/module_utils/v4/vmm/helpers.py +++ b/plugins/module_utils/v4/vmm/helpers.py @@ -6,6 +6,15 @@ def get_vm(module, api_instance, ext_id): + """ + Get VM by ext_id + Args: + module: Ansible module + api_instance: VmApi instance from ntnx_vmm_py_client sdk + ext_id: ext_id of VM + Returns: + vm (obj): VM info object + """ try: return api_instance.get_vm_by_id(extId=ext_id).data except Exception as e: @@ -17,6 +26,16 @@ def get_vm(module, api_instance, ext_id): def get_nic(module, api_instance, ext_id, vm_ext_id): + """ + Get NIC by ext_id + Args: + module: Ansible module + api_instance: VmApi instance from ntnx_vmm_py_client sdk + ext_id: ext_id of NIC + vm_ext_id: ext_id of VM + Returns: + nic (obj): NIC info object + """ try: return api_instance.get_nic_by_id(vmExtId=vm_ext_id, extId=ext_id).data except Exception as e: @@ -28,6 +47,15 @@ def get_nic(module, api_instance, ext_id, vm_ext_id): def get_ngt_status(module, api_instance, vm_ext_id): + """ + Get NGT info by vm ext_id + Args: + module: Ansible module + api_instance: VmApi instance from ntnx_vmm_py_client sdk + vm_ext_id: ext_id of VM + Returns: + ngt (obj): NGT info object + """ try: return api_instance.get_guest_tools_by_id(extId=vm_ext_id).data except Exception as e: @@ -39,6 +67,16 @@ def get_ngt_status(module, api_instance, vm_ext_id): def get_disk(module, api_instance, ext_id, vm_ext_id): + """ + Get Disk by ext_id + Args: + module: Ansible module + api_instance: VmApi instance from ntnx_vmm_py_client sdk + ext_id: ext_id of Disk + vm_ext_id: ext_id of VM + Returns: + disk (obj): Disk info object + """ try: return api_instance.get_disk_by_id(vmExtId=vm_ext_id, extId=ext_id).data except Exception as e: @@ -50,6 +88,16 @@ def get_disk(module, api_instance, ext_id, vm_ext_id): def get_serial_port(module, api_instance, ext_id, vm_ext_id): + """ + Get Serial Port by ext_id + Args: + module: Ansible module + api_instance: VmApi instance from ntnx_vmm_py_client sdk + ext_id: ext_id of Serial Port + vm_ext_id: ext_id of VM + Returns: + serial_port (obj): Serial Port info object + """ try: return api_instance.get_serial_port_by_id(vmExtId=vm_ext_id, extId=ext_id).data except Exception as e: @@ -61,6 +109,15 @@ def get_serial_port(module, api_instance, ext_id, vm_ext_id): def get_template(module, api_instance, ext_id): + """ + Get Template by ext_id + Args: + module: Ansible module + api_instance: VmApi instance from ntnx_vmm_py_client sdk + ext_id: ext_id of Template + Returns: + template (obj): Template info object + """ try: return api_instance.get_template_by_id(extId=ext_id).data except Exception as e: @@ -72,6 +129,16 @@ def get_template(module, api_instance, ext_id): def get_cd_rom(module, api_instance, ext_id, vm_ext_id): + """ + Get CD ROM by ext_id + Args: + module: Ansible module + api_instance: VmApi instance from ntnx_vmm_py_client sdk + ext_id: ext_id of CD ROM + vm_ext_id: ext_id of VM + Returns: + cd_rom (obj): CD ROM info object + """ try: return api_instance.get_cd_rom_by_id(vmExtId=vm_ext_id, extId=ext_id).data except Exception as e: @@ -83,6 +150,16 @@ def get_cd_rom(module, api_instance, ext_id, vm_ext_id): def get_gpu(module, api_instance, ext_id, vm_ext_id): + """ + Get GPU by ext_id + Args: + module: Ansible module + api_instance: VmApi instance from ntnx_vmm_py_client sdk + ext_id: ext_id of GPU + vm_ext_id: ext_id of VM + Returns: + gpu (obj): GPU info object + """ try: return api_instance.get_gpu_by_id(vmExtId=vm_ext_id, extId=ext_id).data except Exception as e: diff --git a/plugins/modules/ntnx_vms_ngt_info_v2.py b/plugins/modules/ntnx_vms_ngt_info_v2.py index 6b3d493e..6f9229dd 100644 --- a/plugins/modules/ntnx_vms_ngt_info_v2.py +++ b/plugins/modules/ntnx_vms_ngt_info_v2.py @@ -35,7 +35,6 @@ validate_certs: false ext_id: "98b9dc89-be08-3c56-b554-692b8b676fd1" register: result - """ RETURN = r""" diff --git a/tests/integration/targets/prepare_env/playbooks/prepare_env.yml b/tests/integration/targets/prepare_env/playbooks/prepare_env.yml index ce6f5c67..1159d1c7 100644 --- a/tests/integration/targets/prepare_env/playbooks/prepare_env.yml +++ b/tests/integration/targets/prepare_env/playbooks/prepare_env.yml @@ -222,4 +222,3 @@ mode: "0644" url: "{{ unattendxml.url }}" dest: "{{ unattendxml.dest }}" -