community.network icon indicating copy to clipboard operation
community.network copied to clipboard

community.network.bigmon_chain should report not installed

Open jmsalvador2395 opened this issue 11 months ago • 1 comments

SUMMARY

when not installed, module community.network.bigmon_chain fails at bigmon_chain.py, line 86 with error TypeError: 'NoneType' object is not subscriptable

ISSUE TYPE
  • Bug Report
COMPONENT NAME

bigmon_chain

ANSIBLE VERSION
ansible [core 2.14.5]
  config file = None
  configured module search path = ['/home/john/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /data/john/projects/cf/env/lib/python3.10/site-packages/ansible
  ansible collection location = /home/john/.ansible/collections:/usr/share/ansible/collections
  executable location = /data/john/projects/cf/env/bin/ansible
  python version = 3.10.11 (main, Apr 20 2023, 19:02:41) [GCC 11.2.0] (/data/john/projects/cf/env/bin/python)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
# /data/john/projects/cf/env/lib/python3.10/site-packages/ansible_collections
Collection        Version
----------------- -------
community.network 5.0.0
CONFIGURATION
CONFIG_FILE() = None
OS / ENVIRONMENT
  • OS: ubuntu
STEPS TO REPRODUCE
  1. use example playbook, example.yaml and change the hosts field from example_server to your ejabberd server
---
- name: Test Ansible Compiler for community.network.bigmon_chain
  hosts: localhost
  gather_facts: false

  vars:
    access_token: "<access token>"
    controller: "10.1.1.1"
    name: "my_chain"
    state: present
    validate_certs: false

  tasks:
    - name: Test community.network.bigmon_chain module
      community.network.bigmon_chain:
        access_token: "{{ access_token }}"
        controller: "{{ controller }}"
        name: "{{ name }}"
        state: "{{ state }}"
        validate_certs: "{{ validate_certs }}"
  1. run as: ansible-playbook -i hosts.ini example.yaml
EXPECTED RESULTS
  • bigmon_chain reports not installed
ACTUAL RESULTS
[WARNING]: Found variable using reserved name: name
ansible-playbook [core 2.14.5]
  config file = None
  configured module search path = ['/home/john/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /data/john/projects/cf/env/lib/python3.10/site-packages/ansible
  ansible collection location = /home/john/.ansible/collections:/usr/share/ansible/collections
  executable location = /data/john/projects/cf/env/bin/ansible-playbook
  python version = 3.10.11 (main, Apr 20 2023, 19:02:41) [GCC 11.2.0] (/data/john/projects/cf/env/bin/python)
  jinja version = 3.1.2
  libyaml = True
No config file found; using defaults
host_list declined parsing /data/john/projects/cf/data/module_yaml/20230706-083357/base/community.network.bigmon_chain/hosts.ini as it did not pass its verify_file() method
script declined parsing /data/john/projects/cf/data/module_yaml/20230706-083357/base/community.network.bigmon_chain/hosts.ini as it did not pass its verify_file() method
auto declined parsing /data/john/projects/cf/data/module_yaml/20230706-083357/base/community.network.bigmon_chain/hosts.ini as it did not pass its verify_file() method
yaml declined parsing /data/john/projects/cf/data/module_yaml/20230706-083357/base/community.network.bigmon_chain/hosts.ini as it did not pass its verify_file() method
Parsed /data/john/projects/cf/data/module_yaml/20230706-083357/base/community.network.bigmon_chain/hosts.ini inventory source with ini plugin
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.

PLAYBOOK: example.yaml *************************************************************
1 plays in example.yaml

PLAY [Test Ansible Compiler for community.network.bigmon_chain] ****************

TASK [Test community.network.bigmon_chain module] ******************************
task path: /data/john/projects/cf/data/module_yaml/20230706-083357/base/community.network.bigmon_chain/example.yaml:14
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: john
<127.0.0.1> EXEC /bin/sh -c 'echo ~john && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/john/.ansible/tmp `"&& mkdir "` echo /home/john/.ansible/tmp/ansible-tmp-1689303398.9984987-2872610-147555249331620 `" && echo ansible-tmp-1689303398.9984987-2872610-147555249331620="` echo /home/john/.ansible/tmp/ansible-tmp-1689303398.9984987-2872610-147555249331620 `" ) && sleep 0'
Using module file /data/john/projects/cf/env/lib/python3.10/site-packages/ansible_collections/community/network/plugins/modules/bigmon_chain.py
<127.0.0.1> PUT /home/john/.ansible/tmp/ansible-local-287260694lnrxjf/tmp558cugzs TO /home/john/.ansible/tmp/ansible-tmp-1689303398.9984987-2872610-147555249331620/AnsiballZ_bigmon_chain.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/john/.ansible/tmp/ansible-tmp-1689303398.9984987-2872610-147555249331620/ /home/john/.ansible/tmp/ansible-tmp-1689303398.9984987-2872610-147555249331620/AnsiballZ_bigmon_chain.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/data/john/projects/cf/env/bin/python /home/john/.ansible/tmp/ansible-tmp-1689303398.9984987-2872610-147555249331620/AnsiballZ_bigmon_chain.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/john/.ansible/tmp/ansible-tmp-1689303398.9984987-2872610-147555249331620/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_community.network.bigmon_chain_payload_t1n5si0i/ansible_community.network.bigmon_chain_payload.zip/ansible_collections/community/network/plugins/modules/bigmon_chain.py", line 126, in main
  File "/tmp/ansible_community.network.bigmon_chain_payload_t1n5si0i/ansible_community.network.bigmon_chain_payload.zip/ansible_collections/community/network/plugins/modules/bigmon_chain.py", line 86, in chain
TypeError: 'NoneType' object is not subscriptable
fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "access_token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "controller": "10.1.1.1",
            "name": "my_chain",
            "state": "present",
            "validate_certs": false
        }
    },
    "msg": "'NoneType' object is not subscriptable"
}

PLAY RECAP *********************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

jmsalvador2395 avatar Jul 15 '23 17:07 jmsalvador2395

@jmsalvador2395 htllo, thanks for reporting the issue!

cc @tedelhourani

If anyone wants to fix this, here's a Quick-start guide

Andersson007 avatar Jul 18 '23 08:07 Andersson007