Pure-Storage-Ansible / FlashArray-Collection

Ansible Collection for Pure Storage FlashArray
GNU General Public License v3.0
19 stars 21 forks source link

AttributeError with purefa_inventory and purity 6.5.1 #535

Closed ajw1980 closed 5 months ago

ajw1980 commented 5 months ago

I'm running ansible 8.7 and using purefa_inventory:

- name: collect pure inventory
  purestorage.flasharray.purefa_inventory:
    fa_url: "{{ inventory_hostname }}"
    api_token: "{{ pure_api_token }}"
  register: pure_inventory
  delegate_to: localhost

Running that on a device with Purity//FA 6.5.1 I get this:

MODULE FAILURE
See stdout/stderr for the exact error

                                                                                                                                                                                                 MODULE_STDERR:

Traceback (most recent call last):
  File "<stdin>", line 107, in <module>                                                                                                                                                            File "<stdin>", line 99, in _ansiballz_main
  File "<stdin>", line 47, in invoke_module
  File "/usr/lib64/python3.9/runpy.py", line 225, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)                                                                                                                                File "/usr/lib64/python3.9/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/lib64/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)                                                                                                                                                                        File "/tmp/ansible_purestorage.flasharray.purefa_inventory_payload_9zmgfd44/ansible_purestorage.flasharray.purefa_inventory_payload.zip/ansible_collections/purestorage/flasharray/plugins/modules/purefa_inventory.py", line 368, in <module>
  File "/tmp/ansible_purestorage.flasharray.purefa_inventory_payload_9zmgfd44/ansible_purestorage.flasharray.purefa_inventory_payload.zip/ansible_collections/purestorage/flasharray/plugins/modules/purefa_inventory.py", line 361, in main                                                                                                                                                        File "/tmp/ansible_purestorage.flasharray.purefa_inventory_payload_9zmgfd44/ansible_purestorage.flasharray.purefa_inventory_payload.zip/ansible_collections/purestorage/flasharray/plugins/modules/purefa_inventory.py", line 148, in generate_new_hardware_dict
  File "/install/software/ansible/ansible-8.7/lib/python3.9/site-packages/pypureclient/flasharray/FA_2_26/models/network_interfaces_port_details.py", line 116, in __getattribute__
    raise AttributeError                                                                                                                                                                         AttributeError

I can modify purefa_inventory.py to set SFP_API_VERSION = "skip" to skip the extra port details section and it works correctly. It seems like several of those attributes are not being defined.

I also tested this on a device using version 6.3.15 and the unmodified version works ok.

sdodsley commented 5 months ago

@ajw1980 thanks for reporting this - we will get on this ASAP

sdodsley commented 5 months ago

@ajw1980 can you tell me what the connectivity of your FlashArray is? eg iSCSI, FC, NVMe-FC, etc

ajw1980 commented 5 months ago

It is iSCSI over ethernet. The physical connection is a 4x25 Gb twinax cable on the pure to a 100 Gb port on the switch side.

sdodsley commented 5 months ago

@ajw1980 please test the associated PR

ajw1980 commented 5 months ago

Yes, seems to be looking ok on both versions now.