Forum Discussion

gajanan_mudalia's avatar
3 years ago

Hello, I am getting an error in ansible .ansible/collections/ansible_collections/purestorage/flasharray/plugins/module_utils/purefa.py

Hello, I am getting an error in ansible .ansible/collections/ansible_collections/purestorage/flasharray/plugins/module_utils/purefa.py module when the following ansible-playbook is run ```- hosts: localhost gather_facts: true collections: - purestorage.flasharray vars: src_fa_url: <renamed-pure_name> src_api_token: <hidden> tasks: - name: Get source FlashArray info purefa_info: gather_subset: - minimum - network - interfaces fa_url: "{{ src_fa_url }}" api_token: "{{ src_api_token }}" register: src_array_info``` The code is breaking in “def get_system(module):” function in purefa.py The following code runs fine with PurityOS 5.3.12 but gives an error in 6.2.6 Is there any quick fix for this?? !channel Flasharray collection is VERSION = 1.4 USER_AGENT_BASE = “Ansible”
  • Error message with -vvv option ```The full traceback is: WARNING: The below traceback may *not* be related to the actual failure. File "/tmp/ansible_purefa_info_payload_JB8L3X/ansible_purefa_info_payload.zip/ansible_collections/purestorage/flasharray/plugins/modules/purefa_info.py", line 442, in <module> fatal: [localhost]: FAILED! => { "changed": false, "invocation": { "module_args": { "api_token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "fa_url": "<renamed>", "gather_subset": [ "minimum", "network", "interfaces" ] } }, "msg": "py-pure-client and/or requests are not installed." }```
  • Can you do a `pip list` ? The message seems to indicate you might be missing py-pure-client
  • I would suggest you also upgrade to the latest collection which is 1.14
  • Its the latest collection this is the CHANGELOG.rst file ```more CHANGELOG.rst ==================================== Purestorage.Flasharray Release Notes ==================================== .. contents:: Topics v1.14.0 ======= Minor Changes -------------```
  • Here is the pip list ```pip list ansible (2.9.27) Babel (0.9.6) backports.ssl-match-hostname (3.5.0.1) certifi (2020.12.5) cffi (1.6.0) chardet (2.2.1) cloud-init (19.4) configobj (4.7.2) cryptography (1.7.2) decorator (3.4.0) dnspython (1.16.0) enum34 (1.0.4) eventlet (0.33.1) futures (3.1.1) greenlet (2.0.0) hpe3par-sdk (1.2.2) httplib2 (0.18.1) idna (2.4) iniparse (0.4) ipaddress (1.0.16) IPy (0.75) Jinja2 (2.7.2) jmespath (0.9.4) jsonpatch (1.2) jsonpointer (1.9) kitchen (1.1.1) langtable (0.0.31) MarkupSafe (0.11) monotonic (1.6) paramiko (2.1.1) perf (0.1) pip (8.1.2) ply (3.4) policycoreutils-default-encoding (0.1) prettytable (0.7.2) purestorage (1.19.0) purity-fb (1.12.3) pyasn1 (0.1.9) pycparser (2.14) pycurl (7.19.0) pygobject (3.22.0) pygpgme (0.3) pyliblzma (0.5.3) pyserial (2.6) python-3parclient (4.2.12) python-augeas (0.5.0) python-dateutil (2.8.2) python-linux-procfs (0.4.9) pyudev (0.15) pyvmomi (6.5.0.2017.5-1) pyxattr (0.5.1) PyYAML (3.10) redis (2.10.3) requests (2.6.0) schedutils (0.4) seobject (0.1) sepolicy (1.1) setuptools (0.9.8) six (1.16.0) slip (0.4.0) slip.dbus (0.4.0) tornado (4.0.2) urlgrabber (3.10) urllib3 (1.26.12) wheel (0.36.2) yum-langpacks (0.4.2) yum-metadata-parser (1.1.4)```
  • Now the py-pure-client and collections are installed but still get this error. ```# ansible-galaxy collection install purestorage.flasharray -p ~/.ansible/collections Process install dependency map Starting collection install process Installing 'purestorage.flasharray:1.14.0' to '/root/.ansible/collections/ansible_collections/purestorage/flasharray' # ansible-playbook ./test.yml PLAY [localhost] ******************************************************************************************************* TASK [Gathering Facts] ************************************************************************************************* ok: [localhost] TASK [Get source FlashArray info] ************************************************************************************** fatal: [localhost]: FAILED! => {"changed": false, "msg": "py-pure-client and/or requests are not installed."} PLAY RECAP ************************************************************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 # pip list | grep client py-pure-client 1.28.0```
  • I suggest you do a `pip list` from inside the playbook to see if the local shell running the playbook.
  • here you go.. ```changed: [localhost] => { "changed": true, "cmd": "pip list", "delta": "000.758469", "end": "2022-11-08 0500.848182", "invocation": { "module_args": { "_raw_params": "pip list", "_uses_shell": true, "argv": , "chdir": , "creates": , "executable": , "removes": , "stdin": , "stdin_add_newline": true, "strip_empty_ends": true, "warn": true } }, "rc": 0, "start": "2022-11-08 0500.089713", "stderr": "", "stderr_lines": [], "stdout": "Package Version\n------------------ ---------\nbcrypt 4.0.1\ncertifi 2020.12.5\ncffi 1.15.1\nchardet 4.0.0\ncharset-normalizer 2.0.12\ncryptography 3.1.1\nidna 2.10\nparamiko 2.11.0\npip 21.3.1\npy-pure-client 1.28.0\npycparser 2.21\nPyJWT 2.4.0\nPyNaCl 1.5.0\npython-dateutil 2.8.1\nrequests 2.25.1\nsemantic-version 2.10.0\nsetuptools 51.1.2\nsetuptools-rust 1.1.2\nsix 1.15.0\ntyping 3.7.4.3\ntyping_extensions 4.1.1\nurllib3 1.26.5\nwheel 0.37.1", "stdout_lines": [ "Package Version", "------------------ ---------", "bcrypt 4.0.1", "certifi 2020.12.5", "cffi 1.15.1", "chardet 4.0.0", "charset-normalizer 2.0.12", "cryptography 3.1.1", "idna 2.10", "paramiko 2.11.0", "pip 21.3.1", "py-pure-client 1.28.0", "pycparser 2.21", "PyJWT 2.4.0", "PyNaCl 1.5.0", "python-dateutil 2.8.1", "requests 2.25.1", "semantic-version 2.10.0", "setuptools 51.1.2", "setuptools-rust 1.1.2", "six 1.15.0", "typing 3.7.4.3", "typing_extensions 4.1.1", "urllib3 1.26.5", "wheel 0.37.1" ] }```