Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Ansible 2.8 devel refactor breaks vmware_gather_moids #79

Open
richard-olson opened this issue Nov 28, 2018 · 3 comments
Open

Ansible 2.8 devel refactor breaks vmware_gather_moids #79

richard-olson opened this issue Nov 28, 2018 · 3 comments

Comments

@richard-olson
Copy link

Recent code re-factoring of the core Ansible vmware module utils has removed the find_cluster_by_name_datacenter function resulting in the following error when using the vmware_gather_moids module in this repo.

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NameError: global name 'find_cluster_by_name_datacenter' is not defined
fatal: [host.lab.home.local]: FAILED! => changed=false 
  module_stderr: |-
    Traceback (most recent call last):
      File "/home/rich/.ansible/tmp/ansible-tmp-1543383966.18-177345832560939/AnsiballZ_vcenter_gather_moids.py", line 113, in <module>
        _ansiballz_main()
      File "/home/rich/.ansible/tmp/ansible-tmp-1543383966.18-177345832560939/AnsiballZ_vcenter_gather_moids.py", line 105, in _ansiballz_main
        invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
      File "/home/rich/.ansible/tmp/ansible-tmp-1543383966.18-177345832560939/AnsiballZ_vcenter_gather_moids.py", line 48, in invoke_module
        imp.load_module('__main__', mod, module, MOD_DESC)
      File "/tmp/ansible_vcenter_gather_moids_payload_mQjtSO/__main__.py", line 97, in <module>
      File "/tmp/ansible_vcenter_gather_moids_payload_mQjtSO/__main__.py", line 81, in main
    NameError: global name 'find_cluster_by_name_datacenter' is not defined
  module_stdout: ''
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error
  rc: 1
@nagonzalez
Copy link

Bummer. Got the same error. Is this still an issue or did you come up with a workaround?

@doingway2much
Copy link

I was able to get around this by uninstalling Ansible 2.8 and installing Ansible 2.7.11. Once that was done I no longer got the error above.

@nagonzalez
Copy link

Ahh, right on.

In case your curious, I was able to get it to work with Ansible 2.8. by making the following changes to vcenter_gather_moids.py

change:

        if searched_parameter == 'cluster_name' and module.params[searched_parameter]:
            object_mo = find_cluster_by_name_datacenter(datacenter_mo, module.params[searched_parameter])

to

        if searched_parameter == 'cluster_name' and module.params[searched_parameter]:
            object_mo = find_cluster_by_name(content, module.params[searched_parameter], datacenter_mo)

I should probably shoot PR :)

jpiron added a commit to jpiron/nsxansible that referenced this issue Nov 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants