Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collection broken since Ansible 2.17 #54

Closed
DegerfeldtConsulting opened this issue Sep 19, 2024 · 2 comments · Fixed by #56
Closed

Collection broken since Ansible 2.17 #54

DegerfeldtConsulting opened this issue Sep 19, 2024 · 2 comments · Fixed by #56
Assignees
Labels
bug Something isn't working

Comments

@DegerfeldtConsulting
Copy link

DegerfeldtConsulting commented Sep 19, 2024

🐛 Bug Report

Collection will throw an error saying that 'cohesity_common_argument_spec' is undefined.

"Traceback (most recent call last):\n File \"/runner/.ansible/tmp/ansible-tmp-1726482479.5260842-22-9790455554391/AnsiballZ_cohesity_facts.py\", line 107, in <module>\n _ansiballz_main()\n File \"/runner/.ansible/tmp/ansible-tmp-1726482479.5260842-22-9790455554391/AnsiballZ_cohesity_facts.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/runner/.ansible/tmp/ansible-tmp-1726482479.5260842-22-9790455554391/AnsiballZ_cohesity_facts.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.cohesity.dataprotect.plugins.modules.cohesity_facts', init_globals=dict(_module_fqn='ansible_collections.cohesity.dataprotect.plugins.modules.cohesity_facts', _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_cohesity.dataprotect.cohesity_facts_payload_7ut553sr/ansible_cohesity.dataprotect.cohesity_facts_payload.zip/ansible_collections/cohesity/dataprotect/plugins/modules/cohesity_facts.py\", line 241, in <module>\n File \"/tmp/ansible_cohesity.dataprotect.cohesity_facts_payload_7ut553sr/ansible_cohesity.dataprotect.cohesity_facts_payload.zip/ansible_collections/cohesity/dataprotect/plugins/modules/cohesity_facts.py\", line 152, in main\nNameError: name 'cohesity_common_argument_spec' is not defined\n"

To Reproduce

(Write your steps here:)

  1. Install Ansible 2.17+
  2. Run any module (as far as I know)

Expected behavior

I expect get__cohesity_auth__token to work

Actual Behavior

Issue seems to be due to Python2 being removed from Ansible in version 2.17. When Python2 was removed, so was 'urllib_error' from ansible.module_utils.urls. This function is imported in cohesity_auth, but the error is thrown for cohesity_common_argument_spec because you have wrapped them in the same try except so that the import of all the preceeding functions are skipped.

try:
    from ansible_collections.cohesity.dataprotect.plugins.module_utils.cohesity_auth import (
        get__cohesity_auth__token,
    )
    from ansible_collections.cohesity.dataprotect.plugins.module_utils.cohesity_utilities import (
        cohesity_common_argument_spec,
    )
    from ansible_collections.cohesity.dataprotect.plugins.module_utils.cohesity_hints import (
        get__cluster,
        get__nodes,
        get_cohesity_client,
        get__prot_source__all,
        get__prot_policy__all,
        get__prot_job__all,
        get__storage_domain_id__all,
        get__protection_run__all,
    )

except Exception:
    pass

Collection needs to be updated and remove all python2 references
@johnwarlick
Copy link

Running into this as well, downgrading to ansible-core==2.16.12 worked.

@kavinagrawalcohesity
Copy link
Contributor

Fixed in #56

@kavinagrawalcohesity kavinagrawalcohesity added the bug Something isn't working label Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants