vmware / pyvmomi

VMware vSphere API Python Bindings
Apache License 2.0
2.19k stars 766 forks source link

Syntax Error is Version.py #1069

Closed jared-bloomer closed 2 months ago

jared-bloomer commented 2 months ago

Describe the bug

When installing python3-pyvmovi 6.7.1-4 on debian, it throws the error

/usr/lib/python3/dist-packages/pyVmomi/Version.py:26: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if isLegacy or ns is "":

I am not sure of the impact of this but I have found that VmomiJSONEncoder appears to be missing after the installation.

Reproduction steps

  1. apt install python3-pyvmomi

Expected behavior

Package installs successfully without any WARNINGs or ERRORs and all functionality is available.

Additional context

We used this package with Ansible

TASK [buildvm : clone the VM] ***********************************************************************************************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: module 'pyVmomi.VmomiSupport' has no attribute 'VmomiJSONEncoder'
fatal: [myserver.example.com -> localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1714141775.437987-844-45799878760202/AnsiballZ_vmware_guest.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1714141775.437987-844-45799878760202/AnsiballZ_vmware_guest.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1714141775.437987-844-45799878760202/AnsiballZ_vmware_guest.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.community.vmware.plugins.modules.vmware_guest', init_globals=dict(_module_fqn='ansible_collections.community.vmware.plugins.modules.vmware_guest', _modlib_path=modlib_path),\n  File \"<frozen runpy>\", line 226, in run_module\n  File \"<frozen runpy>\", line 98, in _run_module_code\n  File \"<frozen runpy>\", line 88, in _run_code\n  File \"/tmp/ansible_vmware_guest_payload_tthdix17/ansible_vmware_guest_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_guest.py\", line 3647, in <module>\n  File \"/tmp/ansible_vmware_guest_payload_tthdix17/ansible_vmware_guest_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_guest.py\", line 3636, in main\n  File \"/tmp/ansible_vmware_guest_payload_tthdix17/ansible_vmware_guest_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_guest.py\", line 3160, in deploy_vm\n  File \"/tmp/ansible_vmware_guest_payload_tthdix17/ansible_vmware_guest_payload.zip/ansible_collections/community/vmware/plugins/module_utils/vmware.py\", line 955, in set_vm_power_state\n  File \"/tmp/ansible_vmware_guest_payload_tthdix17/ansible_vmware_guest_payload.zip/ansible_collections/community/vmware/plugins/module_utils/vmware.py\", line 458, in gather_vm_facts\nAttributeError: module 'pyVmomi.VmomiSupport' has no attribute 'VmomiJSONEncoder'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
    to retry, use: --limit @/data/playbooks/buildvm.retry
DanielDraganov commented 2 months ago

This issue is not relevant to the code in pyVmomi's top of tree. The debian package - python3-pyvmovi, is not maintained by the pyVmomi project maintainers.