Pure-Storage-Ansible / FlashBlade-Collection

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

FileSystem' object has no attribute 'continuous_availability_enabled #288

Closed nbarriere closed 3 weeks ago

nbarriere commented 3 weeks ago

We receive an error during the filesystem creation with the module purefb_fs but the filesystem is created.

playbook:

---
- name: Pure FlashBlade Filesystems Configuration
  hosts: localhost
  collections:
    - purestorage.flashblade
  vars:
    fb_url: nas.fake.net
    fb_api_token: XXXXXXXXXXXXXXXXXXXXXXXXX
  tasks:
    - name: Filesystem - test_ansible
      purestorage.flashblade.purefb_fs:
        name: test_ansible
        access_control: shared
        client_policy: ""
        export_policy: ""
        nfs_rules: ""
        policy: ""
        policy_state: present
        size: 1T
        hard_limit: False
        nfsv3: True
        nfsv4: True
        http: False
        smb: False
        snapshot: True
        fastremove: False
        writable: True
        state: present
        fb_url: "{{ fb_url }}"
        api_token: "{{ fb_api_token }}"
        disable_warnings: True

Error:

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

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

TASK [Filesystem - test_ansible] ******************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'FileSystem' object has no attribute 'continuous_availability_enabled'
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/home/nbarriere/.ansible/tmp/ansible-tmp-1719836895.964377-853-91837512875287/AnsiballZ_purefb_fs.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/home/nbarriere/.ansible/tmp/ansible-tmp-1719836895.964377-853-91837512875287/AnsiballZ_purefb_fs.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/nbarriere/.ansible/tmp/ansible-tmp-1719836895.964377-853-91837512875287/AnsiballZ_purefb_fs.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.purestorage.flashblade.plugins.modules.purefb_fs', init_globals=dict(_module_fqn='ansible_collections.purestorage.flashblade.plugins.modules.purefb_fs', _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_fs_payload_5yf1ieo3/ansible_purestorage.flashblade.purefb_fs_payload.zip/ansible_collections/purestorage/flashblade/plugins/modules/purefb_fs.py\", line 1150, in <module>\n  File \"/tmp/ansible_purestorage.flashblade.purefb_fs_payload_5yf1ieo3/ansible_purestorage.flashblade.purefb_fs_payload.zip/ansible_collections/purestorage/flashblade/plugins/modules/purefb_fs.py\", line 1139, in main\n  File \"/tmp/ansible_purestorage.flashblade.purefb_fs_payload_5yf1ieo3/ansible_purestorage.flashblade.purefb_fs_payload.zip/ansible_collections/purestorage/flashblade/plugins/modules/purefb_fs.py\", line 914, in modify_fs\n  File \"/home/nbarriere/.local/lib/python3.11/site-packages/pypureclient/flashblade/FB_2_12/models/file_system.py\", line 174, in __getattribute__\n    value = object.__getattribute__(self, item)\n            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAttributeError: 'FileSystem' object has no attribute 'continuous_availability_enabled'\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
sdodsley commented 3 weeks ago

@nbarriere please check if #289 fixes your issue and let me know.

nbarriere commented 3 weeks ago

Yes, it fix the issue.

But I have a new problem when I run the same playbook a second time.

└─$ ansible-playbook test/fs_test.yaml
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

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

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

TASK [Filesystem - test_ansible] ******************************************************************************************************
changed: [localhost]

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

┌──(nbarriere㉿nb-laptop)-[/mnt/c/git/pure-fb-automation]
└─$ ansible-playbook test/fs_test.yaml
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

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

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

TASK [Filesystem - test_ansible] ******************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: UnboundLocalError: cannot access local variable 'change_go' where it is not associated with a value
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/home/nbarriere/.ansible/tmp/ansible-tmp-1719851161.2152703-1182-80025412614354/AnsiballZ_purefb_fs.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/home/nbarriere/.ansible/tmp/ansible-tmp-1719851161.2152703-1182-80025412614354/AnsiballZ_purefb_fs.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/nbarriere/.ansible/tmp/ansible-tmp-1719851161.2152703-1182-80025412614354/AnsiballZ_purefb_fs.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.purestorage.flashblade.plugins.modules.purefb_fs', init_globals=dict(_module_fqn='ansible_collections.purestorage.flashblade.plugins.modules.purefb_fs', _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_fs_payload_0bqhdvnh/ansible_purestorage.flashblade.purefb_fs_payload.zip/ansible_collections/purestorage/flashblade/plugins/modules/purefb_fs.py\", line 1150, in <module>\n  File \"/tmp/ansible_purestorage.flashblade.purefb_fs_payload_0bqhdvnh/ansible_purestorage.flashblade.purefb_fs_payload.zip/ansible_collections/purestorage/flashblade/plugins/modules/purefb_fs.py\", line 1139, in main\n  File \"/tmp/ansible_purestorage.flashblade.purefb_fs_payload_0bqhdvnh/ansible_purestorage.flashblade.purefb_fs_payload.zip/ansible_collections/purestorage/flashblade/plugins/modules/purefb_fs.py\", line 957, in modify_fs\nUnboundLocalError: cannot access local variable 'change_go' where it is not associated with a value\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