Pure-Storage-Ansible / FlashBlade-Collection

Ansible Collection for Pure Storage FlashBlade
GNU General Public License v3.0
3 stars 8 forks source link

MODULE FAILURE AttributeError: 'Space' object has no attribute 'capacity #284

Closed nbarriere closed 3 months ago

nbarriere commented 3 months ago

We get some errors when we try to read FB info with the module purestorage.flashblade.purefb_info.

playbook:

---
- name: Pure FlashBlade Get info
  hosts: localhost
  collections:
    - purestorage.flashblade
  vars:
    fb_url: nas.fake.net
    fb_api_token: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  tasks:
    - name: collect all info - test_ansible
      purestorage.flashblade.purefb_info:
        gather_subset:
          - all
        fb_url: "{{ fb_url }}"
        api_token: "{{ fb_api_token }}"
      register: blade_info
    - name: show all information
      debug:
        msg: "{{ blade_info['purefb_info'] }}"

Result:


PLAY [Pure FlashBlade Filesystems Configuration] ***********************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************************************************
ok: [localhost]

TASK [collect all info - test_ansible] *********************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'Space' object has no attribute 'capacity'
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/home/nbarriere/.ansible/tmp/ansible-tmp-1719481500.837731-2666-125285687065984/AnsiballZ_purefb_info.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/home/nbarriere/.ansible/tmp/ansible-tmp-1719481500.837731-2666-125285687065984/AnsiballZ_purefb_info.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/nbarriere/.ansible/tmp/ansible-tmp-1719481500.837731-2666-125285687065984/AnsiballZ_purefb_info.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.purestorage.flashblade.plugins.modules.purefb_info', init_globals=dict(_module_fqn='ansible_collections.purestorage.flashblade.plugins.modules.purefb_info', _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_purestorage.flashblade.purefb_info_payload_dfetuucl/ansible_purestorage.flashblade.purefb_info_payload.zip/ansible_collections/purestorage/flashblade/plugins/modules/purefb_info.py\", line 1454, in <module>\n  File \"/tmp/ansible_purestorage.flashblade.purefb_info_payload_dfetuucl/ansible_purestorage.flashblade.purefb_info_payload.zip/ansible_collections/purestorage/flashblade/plugins/modules/purefb_info.py\", line 1395, in main\n  File \"/tmp/ansible_purestorage.flashblade.purefb_info_payload_dfetuucl/ansible_purestorage.flashblade.purefb_info_payload.zip/ansible_collections/purestorage/flashblade/plugins/modules/purefb_info.py\", line 612, in generate_capacity_dict\n  File \"/home/nbarriere/.local/lib/python3.11/site-packages/pypureclient/flashblade/FB_2_12/models/space.py\", line 125, in __getattribute__\n    value = object.__getattribute__(self, item)\n            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAttributeError: 'Space' object has no attribute 'capacity'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

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

Versions:

FlashBlade//S Multi-chassis: 4.3.8

purestorage.flashblade:1.17.0

/usr/src/app # pip freeze
ansible==10.1.0
ansible-core==2.17.1
bcrypt==4.1.3
certifi==2024.6.2
cffi==1.16.0
charset-normalizer==3.3.2
cryptography==42.0.8
DateTime==5.5
distro==1.9.0
idna==3.7
Jinja2==3.1.4
MarkupSafe==2.1.5
netaddr==1.3.0
packaging==24.1
paramiko==3.4.0
purity-fb==1.12.3
py-pure-client==1.52.0
pycparser==2.22
PyJWT==2.8.0
PyNaCl==1.5.0
python-dateutil==2.9.0.post0
python-dotenv==1.0.1
pytz==2024.1
PyYAML==6.0.1
requests==2.32.3
resolvelib==1.0.1
setuptools==69.2.0
six==1.16.0
urllib3==2.2.2
wheel==0.43.0
zope.interface==6.4.post2
nbarriere commented 3 months ago

We have a new error with the fix:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ValueError: Invalid value for `available_provisioned`, must be a value greater than or equal to `0`
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/home/nbarriere/.ansible/tmp/ansible-tmp-1719816890.6335025-651-6387252547878/AnsiballZ_purefb_info.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/home/nbarriere/.ansible/tmp/ansible-tmp-1719816890.6335025-651-6387252547878/AnsiballZ_purefb_info.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/nbarriere/.ansible/tmp/ansible-tmp-1719816890.6335025-651-6387252547878/AnsiballZ_purefb_info.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.purestorage.flashblade.plugins.modules.purefb_info', init_globals=dict(_module_fqn='ansible_collections.purestorage.flashblade.plugins.modules.purefb_info', _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_purestorage.flashblade.purefb_info_payload_0y4lsdiu/ansible_purestorage.flashblade.purefb_info_payload.zip/ansible_collections/purestorage/flashblade/plugins/modules/purefb_info.py\", line 1458, in <module>\n  File \"/tmp/ansible_purestorage.flashblade.purefb_info_payload_0y4lsdiu/ansible_purestorage.flashblade.purefb_info_payload.zip/ansible_collections/purestorage/flashblade/plugins/modules/purefb_info.py\", line 1407, in main\n  File \"/tmp/ansible_purestorage.flashblade.purefb_info_payload_0y4lsdiu/ansible_purestorage.flashblade.purefb_info_payload.zip/ansible_collections/purestorage/flashblade/plugins/modules/purefb_info.py\", line 1208, in generate_fs_dict\n  File \"/home/nbarriere/.local/lib/python3.11/site-packages/pypureclient/flashblade/FB_2_12/client.py\", line 8614, in get_file_systems\n    return self._call_api(endpoint, kwargs)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/home/nbarriere/.local/lib/python3.11/site-packages/pypureclient/flashblade/FB_2_12/client.py\", line 20708, in _call_api\n    response = api_function(**kwargs)\n               ^^^^^^^^^^^^^^^^^^^^^^\n  File \"/home/nbarriere/.local/lib/python3.11/site-packages/pypureclient/flashblade/FB_2_12/api/file_systems_api.py\", line 231, in api212_file_systems_get_with_http_info\n    return self.api_client.call_api(\n           ^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/home/nbarriere/.local/lib/python3.11/site-packages/pypureclient/flashblade/FB_2_12/api_client.py\", line 327, in call_api\n    return self.__call_api(resource_path, method,\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/home/nbarriere/.local/lib/python3.11/site-packages/pypureclient/flashblade/FB_2_12/api_client.py\", line 170, in __call_api\n    return_data = self.deserialize(response_data, response_type)\n                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/home/nbarriere/.local/lib/python3.11/site-packages/pypureclient/flashblade/FB_2_12/api_client.py\", line 243, in deserialize\n    return self.__deserialize(data, response_type)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/home/nbarriere/.local/lib/python3.11/site-packages/pypureclient/flashblade/FB_2_12/api_client.py\", line 282, in __deserialize\n    return self.__deserialize_model(data, klass)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/home/nbarriere/.local/lib/python3.11/site-packages/pypureclient/flashblade/FB_2_12/api_client.py\", line 632, in __deserialize_model\n    kwargs[attr] = self.__deserialize(value, attr_type)\n                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/home/nbarriere/.local/lib/python3.11/site-packages/pypureclient/flashblade/FB_2_12/api_client.py\", line 282, in __deserialize\n    return self.__deserialize_model(data, klass)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/home/nbarriere/.local/lib/python3.11/site-packages/pypureclient/flashblade/FB_2_12/api_client.py\", line 632, in __deserialize_model\n    kwargs[attr] = self.__deserialize(value, attr_type)\n                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/home/nbarriere/.local/lib/python3.11/site-packages/pypureclient/flashblade/FB_2_12/api_client.py\", line 282, in __deserialize\n    return self.__deserialize_model(data, klass)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/home/nbarriere/.local/lib/python3.11/site-packages/pypureclient/flashblade/FB_2_12/api_client.py\", line 634, in __deserialize_model\n    instance = klass(**kwargs)\n               ^^^^^^^^^^^^^^^\n  File \"/home/nbarriere/.local/lib/python3.11/site-packages/pypureclient/flashblade/FB_2_12/models/space.py\", line 100, in __init__\n    self.available_provisioned = available_provisioned\n    ^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/home/nbarriere/.local/lib/python3.11/site-packages/pypureclient/flashblade/FB_2_12/models/space.py\", line 116, in __setattr__\n    raise ValueError(\"Invalid value for `available_provisioned`, must be a value greater than or equal to `0`\")\nValueError: Invalid value for `available_provisioned`, must be a value greater than or equal to `0`\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
sdodsley commented 3 months ago

@nbarriere this appears to be a known bug in Purity//FB. Until this is fixed we will revert back to an earlier incarnation of the filesystem reporting. I'll let you know here when the revertion is ready.