opengear / opengear.om

Ansible Network Collection for Opengear OM
GNU General Public License v3.0
8 stars 7 forks source link

Missing files when trying to use the collection #9

Closed richardjohnallsopp closed 8 months ago

richardjohnallsopp commented 1 year ago

Hey folks I'm using the latest version of the collections and I'm hitting this error with HTTPS:

PLAY [all] *********************************************************************************************************************
[WARNING]: errors were encountered during the plugin load for meta: ['opengear_om.meta is not a valid collection reference']

TASK [Get system info] *********************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: FileNotFoundError: [Errno 2] No such file or directory: '/home/avankat/Documents/automated-device-config/opengear.om/plugins/module_utils/network/om/utils/structure.json'
fatal: [home-console-01.encom-corp.net]: FAILED! => changed=false 
  module_stderr: |-
    Traceback (most recent call last):
      File "/home/flynn/.ansible/tmp/ansible-local-1499663e52bzo/ansible-tmp-1694172225.1151688-15000-34930516345751/AnsiballZ_om_facts.py", line 107, in <module>
        _ansiballz_main()
      File "/home/flynn/.ansible/tmp/ansible-local-1499663e52bzo/ansible-tmp-1694172225.1151688-15000-34930516345751/AnsiballZ_om_facts.py", line 99, in _ansiballz_main
        invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
      File "/home/flynn/.ansible/tmp/ansible-local-1499663e52bzo/ansible-tmp-1694172225.1151688-15000-34930516345751/AnsiballZ_om_facts.py", line 47, in invoke_module
        runpy.run_module(mod_name='ansible_collections.opengear.om.plugins.modules.om_facts', init_globals=dict(_module_fqn='ansible_collections.opengear.om.plugins.modules.om_facts', _modlib_path=modlib_path),
      File "/home/flynn/.pyenv/versions/3.9.11/lib/python3.9/runpy.py", line 210, in run_module
        return _run_module_code(code, init_globals, run_name, mod_spec)
      File "/home/flynn/.pyenv/versions/3.9.11/lib/python3.9/runpy.py", line 97, in _run_module_code
        _run_code(code, mod_globals, init_globals,
      File "/home/flynn/.pyenv/versions/3.9.11/lib/python3.9/runpy.py", line 87, in _run_code
        exec(code, run_globals)
      File "/tmp/ansible_opengear.om.om_facts_payload_zvtw2aci/ansible_opengear.om.om_facts_payload.zip/ansible_collections/opengear/om/plugins/modules/om_facts.py", line 109, in <module>
      File "/tmp/ansible_opengear.om.om_facts_payload_zvtw2aci/ansible_opengear.om.om_facts_payload.zip/ansible_collections/opengear/om/plugins/modules/om_facts.py", line 100, in main
      File "/tmp/ansible_opengear.om.om_facts_payload_zvtw2aci/ansible_opengear.om.om_facts_payload.zip/ansible_collections/opengear/om/plugins/module_utils/network/om/facts/facts.py", line 70, in get_facts
      File "/tmp/ansible_opengear.om.om_facts_payload_zvtw2aci/ansible_opengear.om.om_facts_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/facts/facts.py", line 124, in get_network_resources_facts
      File "/tmp/ansible_opengear.om.om_facts_payload_zvtw2aci/ansible_opengear.om.om_facts_payload.zip/ansible_collections/opengear/om/plugins/module_utils/network/om/facts/system/system.py", line 37, in __init__
      File "/tmp/ansible_opengear.om.om_facts_payload_zvtw2aci/ansible_opengear.om.om_facts_payload.zip/ansible_collections/opengear/om/plugins/module_utils/network/om/utils/utils.py", line 16, in get_restapi_body_structure
    FileNotFoundError: [Errno 2] No such file or directory: '/home/avankat/Documents/automated-device-config/opengear.om/plugins/module_utils/network/om/utils/structure.json'
  module_stdout: ''
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error
  rc: 1

PLAY RECAP *********************************************************************************************************************
home-console-01.encom-corp.net : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0 

I'm running the following Ansible versions:

ansible==6.0.0
ansible-core==2.13.11
ansible-pylibssh==1.1.0

If I remove these variables:

ansible_httpapi_port: 443
ansible_httpapi_use_ssl: true
ansible_httpapi_validate_certs: false

I get this error instead:

PLAY [all] *********************************************************************************************************************************************************************************************
[WARNING]: errors were encountered during the plugin load for meta: ['opengear_om.meta is not a valid collection reference']

TASK [Get system info] *********************************************************************************************************************************************************************************
fatal: [home-console-01.encom-corp.net]: FAILED! => changed=false 
  msg: 'Expecting value: line 1 column 1 (char 0)'

PLAY RECAP *********************************************************************************************************************************************************************************************
home-console-01.encom-corp.net : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

I have the username and password variables set.

Let me know if you would like a new issue for this, I added it here as it was still open.

Looks like this file is missing:

FileNotFoundError: [Errno 2] No such file or directory: '/home/avankat/Documents/automated-device-config/opengear.om/plugins/module_utils/network/om/utils/structure.json'
mattwit commented 12 months ago

Interesting, taking a look!

richardjohnallsopp commented 11 months ago

Interesting, taking a look!

Thanks a lot :-)

richardjohnallsopp commented 11 months ago

@mattwit any update on this bud?

mattwit commented 8 months ago

@richardjohnallsopp Are you using the lastest opengear.om collection v1.0.2?

richardjohnallsopp commented 8 months ago

@mattwit yeah, here is my requirements' file.

collections:
  - name: 'opengear.om'
    version: '1.0.2'
    source: 'https://galaxy.ansible.com'
  - name: 'ansible.netcommon'
    version: '4.1.0'
    source: 'https://galaxy.ansible.com'
Disco402 commented 8 months ago

This is due to https://github.com/opengear/opengear.om/issues/3 @mattwit

Please remove the hardcoded path and make it look at the structure.json in the same folder

Disco402 commented 8 months ago

Something like this? https://github.com/opengear/opengear.om/pull/10

richardjohnallsopp commented 8 months ago

@mattwit yeah thanks, setting the path to

home/.ansible/collections/ansible_collections/opengear/om/plugins/module_utils/network/om/utils/structure.json

Worked for me.

mattwit commented 8 months ago

Great! Sorry for the delay in getting to this one.

richardjohnallsopp commented 8 months ago

Great! Sorry for the delay in getting to this one.

No worries at all :-)