Skip to content

Commit d3d0575

Browse files
authored
vmware_migrate_vmk: Inherit from PyVmomi (#2324)
SUMMARY It feels wrong that this module uses vmware.connect_to_api directly. I think it would be better to inherit from / sub-class PyVmomi ISSUE TYPE Feature Pull Request COMPONENT NAME vmware_migrate_vmk ADDITIONAL INFORMATION #2318
1 parent 4a2aef3 commit d3d0575

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
minor_changes:
2+
- vmware_migrate_vmk - Inherit from / sub-class PyVmomi (https://github.com/ansible-collections/community.vmware/pull/2324).

plugins/modules/vmware_migrate_vmk.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@
8282
from ansible.module_utils.basic import AnsibleModule
8383
from ansible_collections.community.vmware.plugins.module_utils.vmware import (
8484
vmware_argument_spec, find_dvs_by_name, find_hostsystem_by_name,
85-
connect_to_api, find_dvspg_by_name)
85+
PyVmomi, find_dvspg_by_name)
8686

8787

88-
class VMwareMigrateVmk(object):
88+
class VMwareMigrateVmk(PyVmomi):
8989

9090
def __init__(self, module):
91-
self.module = module
91+
super(VMwareMigrateVmk, self).__init__(module)
9292
self.host_system = None
9393
self.migrate_switch_name = self.module.params['migrate_switch_name']
9494
self.migrate_portgroup_name = self.module.params['migrate_portgroup_name']
@@ -97,7 +97,6 @@ def __init__(self, module):
9797
self.esxi_hostname = self.module.params['esxi_hostname']
9898
self.current_portgroup_name = self.module.params['current_portgroup_name']
9999
self.current_switch_name = self.module.params['current_switch_name']
100-
self.content = connect_to_api(module)
101100

102101
def process_state(self):
103102
try:

0 commit comments

Comments
 (0)