Skip to content

Commit

Permalink
Require pyVmomi 6.7.1 (#2071)
Browse files Browse the repository at this point in the history
Require pyVmomi 6.7.1

SUMMARY
At least some of the modules require pyVmomi 6.7.1 or later, but we didn't specify this in the requirements.txt.
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
requirements.txt
ADDITIONAL INFORMATION
6.7.1 has been released 2018-10-23, 5 1/2 years ago.
  • Loading branch information
mariolenz committed May 12, 2024
1 parent 402a6af commit 6baa222
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 21 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/2071-clarify-pyvmomi-requirement.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- Clarify pyVmomi requirement (https://github.com/ansible-collections/community.vmware/pull/2071).
8 changes: 0 additions & 8 deletions plugins/module_utils/vmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@
from pyVim import connect
from pyVmomi import vim, vmodl, VmomiSupport
HAS_PYVMOMI = True
HAS_PYVMOMIJSON = hasattr(VmomiSupport, 'VmomiJSONEncoder')
except ImportError:
PYVMOMI_IMP_ERR = traceback.format_exc()
HAS_PYVMOMI = False
HAS_PYVMOMIJSON = False

from ansible.module_utils._text import to_text, to_native
from ansible.module_utils.six import integer_types, iteritems, string_types, raise_from
Expand Down Expand Up @@ -1972,9 +1970,6 @@ def to_json(self, obj, properties=None):
provided then all properties are deeply converted. The resulting
JSON is sorted to improve human readability.
Requires upstream support from pyVmomi > 6.7.1
(https://github.com/vmware/pyvmomi/pull/732)
Args:
- obj (object): vim object
- properties (list, optional): list of properties following
Expand All @@ -1985,9 +1980,6 @@ def to_json(self, obj, properties=None):
Return:
dict
"""
if not HAS_PYVMOMIJSON:
self.module.fail_json(msg='The installed version of pyvmomi lacks JSON output support; need pyvmomi>6.7.1')

result = dict()
if properties:
for prop in properties:
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/vmware_cluster_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
description:
- Specify the output schema desired.
- The V(summary) output schema is the legacy output from the module.
- The V(vsphere) output schema is the vSphere API class definition which requires pyvmomi>6.7.1.
- The V(vsphere) output schema is the vSphere API class definition.
choices: ['summary', 'vsphere']
default: 'summary'
type: str
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/vmware_datacenter_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
description:
- Specify the output schema desired.
- The V(summary) output schema is the legacy output from the module.
- The V(vsphere) output schema is the vSphere API class definition which requires pyvmomi>6.7.1.
- The V(vsphere) output schema is the vSphere API class definition.
choices: ['summary', 'vsphere']
default: 'summary'
type: str
Expand Down
1 change: 0 additions & 1 deletion plugins/modules/vmware_datastore_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
- Specify the output schema desired.
- The 'summary' output schema is the legacy output from the module
- The 'vsphere' output schema is the vSphere API class definition
which requires pyvmomi>6.7.1
choices: ['summary', 'vsphere']
default: 'summary'
type: str
Expand Down
1 change: 0 additions & 1 deletion plugins/modules/vmware_dvswitch_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
- Specify the output schema desired.
- The 'summary' output schema is the legacy output from the module
- The 'vsphere' output schema is the vSphere API class definition
which requires pyvmomi>6.7.1
choices: ['summary', 'vsphere']
default: 'summary'
type: str
Expand Down
1 change: 0 additions & 1 deletion plugins/modules/vmware_guest_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
- Specify the output schema desired.
- The V(summary) output schema is the legacy output from the module
- The V(vsphere) output schema is the vSphere API class definition
which requires pyvmomi>6.7.1
choices: ['summary', 'vsphere']
default: 'summary'
type: str
Expand Down
1 change: 0 additions & 1 deletion plugins/modules/vmware_host_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
- Specify the output schema desired.
- The V(summary) output schema is the legacy output from the module
- The V(vsphere) output schema is the vSphere API class definition
which requires pyvmomi>6.7.1
choices: ['summary', 'vsphere']
default: 'summary'
type: str
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/vmware_vcenter_settings_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
description:
- Specify the output schema desired.
- The 'summary' output schema is the legacy output from the module.
- The 'vsphere' output schema is the vSphere API class definition which requires pyvmomi>6.7.1.
- The 'vsphere' output schema is the vSphere API class definition.
choices: ['summary', 'vsphere']
default: 'summary'
type: str
Expand Down
5 changes: 0 additions & 5 deletions plugins/modules/vmware_vsan_health_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,9 @@
try:
from pyVmomi import vmodl, VmomiSupport
HAS_PYVMOMI = True
HAS_PYVMOMIJSON = hasattr(VmomiSupport, 'VmomiJSONEncoder')
except ImportError:
PYVMOMI_IMP_ERR = traceback.format_exc()
HAS_PYVMOMI = False
HAS_PYVMOMIJSON = False

VSANPYTHONSDK_IMP_ERR = None
try:
Expand Down Expand Up @@ -186,9 +184,6 @@ def main():
if not HAS_VSANPYTHONSDK:
module.fail_json(msg=missing_required_lib('vSAN Management SDK for Python'), exception=VSANPYTHONSDK_IMP_ERR)

if not HAS_PYVMOMIJSON:
module.fail_json(msg='The installed version of pyvmomi lacks JSON output support; need pyvmomi>6.7.1')

vsan_info_manager = VSANInfoManager(module)
vsan_info_manager.gather_info()

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pyVmomi>=6.7
pyVmomi>=6.7.1
git+https://github.com/vmware/vsphere-automation-sdk-python.git ; python_version >= '2.7' # Python 2.6 is not supported

0 comments on commit 6baa222

Please sign in to comment.