FlashArray-Collection icon indicating copy to clipboard operation
FlashArray-Collection copied to clipboard

Missing the required parameter `pod` when calling `api232_pods_post when using purestorage.flasharray.purefa_pod module

Open calwynb opened this issue 1 year ago • 3 comments

I am trying to create a pod using the purestorage.flasharray (1.30.2) collection.

The firmware version on my pure storage array is: Purity//FA 6.6.6

I have the following python modules installed as per the requirements of the collection:

purestorage 1.19.0 py-pure-client 1.54.0 pycountry 24.6.1 urllib3 2.2.2 requests 2.32.3 netaddr 1.3.0

Below is the task in the role which is failing:

- name: Create new pod
  purestorage.flasharray.purefa_pod:
    name: "{{ pod_name }}"
    fa_url: "{{ flasharray_url }}"
    api_token: "{{ api_token }}"
    disable_warnings: true
    ignore_usage: true
    state: present

Output of the task:

fatal: [localhost]: FAILED! => {
    "changed": false,
    "module_stderr": "/home/vscode/.local/lib/python3.10/site-packages/urllib3/connectionpool.py:1099: InsecureRequestWarning: Unverified HTTPS request is being made to host 'cbmgpurea112.int.capinet'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n  warnings.warn(\nTraceback (most recent call last):\n  File \"/home/vscode/.ansible/tmp/ansible-tmp-1723730897.003421-191918-114221244264712/AnsiballZ_purefa_pod.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/home/vscode/.ansible/tmp/ansible-tmp-1723730897.003421-191918-114221244264712/AnsiballZ_purefa_pod.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/vscode/.ansible/tmp/ansible-tmp-1723730897.003421-191918-114221244264712/AnsiballZ_purefa_pod.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.purestorage.flasharray.plugins.modules.purefa_pod', init_globals=dict(_module_fqn='ansible_collections.purestorage.flasharray.plugins.modules.purefa_pod', _modlib_path=modlib_path),\n  File \"/usr/lib/python3.10/runpy.py\", line 224, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib/python3.10/runpy.py\", line 96, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib/python3.10/runpy.py\", line 86, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_purestorage.flasharray.purefa_pod_payload_59df7gvc/ansible_purestorage.flasharray.purefa_pod_payload.zip/ansible_collections/purestorage/flasharray/plugins/modules/purefa_pod.py\", line 747, in <module>\n  File \"/tmp/ansible_purestorage.flasharray.purefa_pod_payload_59df7gvc/ansible_purestorage.flasharray.purefa_pod_payload.zip/ansible_collections/purestorage/flasharray/plugins/modules/purefa_pod.py\", line 727, in main\n  File \"/tmp/ansible_purestorage.flasharray.purefa_pod_payload_59df7gvc/ansible_purestorage.flasharray.purefa_pod_payload.zip/ansible_collections/purestorage/flasharray/plugins/modules/purefa_pod.py\", line 321, in create_pod\n  File \"/home/vscode/.local/lib/python3.10/site-packages/pypureclient/flasharray/FA_2_32/client.py\", line 17266, in post_pods\n    return self._call_api(endpoint, kwargs)\n  File \"/home/vscode/.local/lib/python3.10/site-packages/pypureclient/flasharray/FA_2_32/client.py\", line 34208, in _call_api\n    response = api_function(**kwargs)\n  File \"/home/vscode/.local/lib/python3.10/site-packages/pypureclient/flasharray/FA_2_32/api/pods_api.py\", line 1437, in api232_pods_post_with_http_info\n    raise TypeError(\"Missing the required parameter `pod` when calling `api232_pods_post`\")\nTypeError: Missing the required parameter `pod` when calling `api232_pods_post`\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

I am very new to pure storage and so don't know a lot about it but I believe I understand the concepts at least as I have worked with other storage arrays in years past.

In the same role, I have a task that successfully creates a volume on this same array.
I have tried downgrading the py-pure-client module as well as the collection to several older versions but I still get this error.

calwynb avatar Aug 15 '24 14:08 calwynb

@calwynb The linked patch will solve your issue. Please check and let us know. We will create a new release shortly and can get this in if it works as expected.

sdodsley avatar Aug 15 '24 16:08 sdodsley

Thank you.

The original error is gone now. Just getting the below error now. Cant find any additional errors messages.

fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "api_token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "delete_contents": false,
            "disable_warnings": false,
            "eradicate": false,
            "fa_url": "purefa.somedomain",
            "failover": null,
            "ignore_usage": false,
            "mediator": "purestorage",
            "name": "SOMEPOD",
            "promote": null,
            "quiesce": null,
            "quota": null,
            "state": "present",
            "stretch": null,
            "target": null,
            "throttle": false,
            "undo": null
        }
    },
    "msg": "SOMEPOD creation failed. Error: None"
}

calwynb avatar Aug 16 '24 11:08 calwynb

@calwynb just made one slight alteration to the patch. Not sure it will resolve this, but please retry. If it still fails, can you post the actual task that is failing, so we can try and reproduce here?

sdodsley avatar Aug 16 '24 14:08 sdodsley

Thank you @sdodsley. I have just tried using the altered module and the issue still persists unfortunately, that new error I posted a couple days ago.

I am using this in a role that I am building. Variables are being pulled in from the vars directory in the role. The three tasks in the role right now are as follows:

Get source FlashArray info (This is working) Create new volume (This is working) Create pod (This does not work)

Code below:

---
# tasks file for dev_srvstor_pure-voladd

- name: Get source FlashArray info
  purestorage.flasharray.purefa_info:
    gather_subset:
    - minimum
    - network
    - interfaces
    fa_url: "{{ flasharray_url }}"
    api_token: "{{ api_token }}"
  register: src_array_info

- name: Create new volume
  purestorage.flasharray.purefa_volume:
    name: "{{ vol_name }}"
    size: 100G
    disable_warnings: true
    fa_url: "{{ flasharray_url }}"
    api_token: "{{ api_token }}"
    state: present

- name: Create pod
  purestorage.flasharray.purefa_pod:
    name: "{{ pod_name }}-{{ src_loc }}"
    fa_url: "{{ flasharray_url }}"
    api_token: "{{ api_token }}"
    state: present

Any help is greatly appreciated!

calwynb avatar Aug 19 '24 05:08 calwynb

@calwynb I am unable to reproduce this error on our internal systems. If there is a possibility we could try and diagnose this on a live call please email me directly at simon@purestorage to schedule something. I am based in the US East Coast timezone.

sdodsley avatar Aug 19 '24 13:08 sdodsley

@sdodsley, thanks for the offer, but it is working now. I am making great progress now. Turns out the storage team had not given the account I am testing with enough access to be able to create a pod. Thank you again for your swift and awesome assistance!!

calwynb avatar Aug 20 '24 12:08 calwynb

Hi

Please let me know if you would rather want a new issue logged. But its a follow on of this issue, as I am getting the same error.

The error happens when running the exact same code as above on AAP EE it works running locally I have been trying to replicate the EE locally to reproduce the error but have not been successful yet. Tested with different versions of packages and python but no luck. Local environment is WSL with Ubuntu so not able to test with RHEL yet. Please find the details of the EE below.

Some additional information when running the playbook to create a pod that already exists does not cause it to fail it just picks up that it exists and returns as ok. It only fails with that error when I change the name to create a new pod.

Getting the error on all the below images

 ################Full EE Base Images#######################  
    # name: registry.redhat.io/ansible-automation-platform-25/ee-supported-rhel9:latest
    # name: registry.redhat.io/ansible-automation-platform-25/ee-supported-rhel8:latest    
    # name: registry.redhat.io/ansible-automation-platform-24/ee-supported-rhel9:latest
    #name: registry.redhat.io/ansible-automation-platform-24/ee-supported-rhel8:latest
   
  
################Minimal EE Base Images#######################    
    # name: registry.redhat.io/ansible-automation-platform-25/ee-minimal-rhel9:latest
    # name: registry.redhat.io/ansible-automation-platform-25/ee-minimal-rhel8:latest    
    # name: registry.redhat.io/ansible-automation-platform-24/ee-minimal-rhel9:latest
    # name: registry.redhat.io/ansible-automation-platform-24/ee-minimal-rhel8:latest

purestorage.flasharray 1.31.1

The firmware version on my pure storage array is: Purity//FA 6.6.10

Python3.9

pip packages

ansible-core==2.15.12 bcrypt==4.2.0 certifi==2024.8.30 cffi==1.17.1 chardet==4.0.0 charset-normalizer==3.4.0 cryptography==43.0.1 idna==2.10 importlib-resources==5.0.7 Jinja2==3.1.4 MarkupSafe==3.0.1 packaging==24.1 paramiko==3.5.0 purestorage==1.19.0 py-pure-client==1.56.0 pycparser==2.22 PyJWT==2.9.0 PyNaCl==1.5.0 python-dateutil==2.8.1 PyYAML==6.0.2 requests==2.32.3 resolvelib==1.0.1 six==1.15.0 typing==3.7.4.3 urllib3==1.26.20

Code

- name: Create new pod
  purestorage.flasharray.purefa_pod:
    name: "{{ pod_name }}"
    fa_url: "{{ flasharray_url }}"
    api_token: "{{ api_token }}"
    disable_warnings: true
    ignore_usage: true
    state: present

Output on AAP

{
  "module_stdout": "",
  "module_stderr": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1728971690.4138806-60-203037595067674/AnsiballZ_purefa_pod.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1728971690.4138806-60-203037595067674/AnsiballZ_purefa_pod.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1728971690.4138806-60-203037595067674/AnsiballZ_purefa_pod.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.purestorage.flasharray.plugins.modules.purefa_pod', init_globals=dict(_module_fqn='ansible_collections.purestorage.flasharray.plugins.modules.purefa_pod', _modlib_path=modlib_path),\n  File \"/usr/lib64/python3.9/runpy.py\", line 225, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib64/python3.9/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib64/python3.9/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_purestorage.flasharray.purefa_pod_payload_s6uajb_j/ansible_purestorage.flasharray.purefa_pod_payload.zip/ansible_collections/purestorage/flasharray/plugins/modules/purefa_pod.py\", line 747, in <module>\n  File \"/tmp/ansible_purestorage.flasharray.purefa_pod_payload_s6uajb_j/ansible_purestorage.flasharray.purefa_pod_payload.zip/ansible_collections/purestorage/flasharray/plugins/modules/purefa_pod.py\", line 727, in main\n  File \"/tmp/ansible_purestorage.flasharray.purefa_pod_payload_s6uajb_j/ansible_purestorage.flasharray.purefa_pod_payload.zip/ansible_collections/purestorage/flasharray/plugins/modules/purefa_pod.py\", line 321, in create_pod\n  File \"/usr/local/lib/python3.9/site-packages/pypureclient/flasharray/FA_2_35/client.py\", line 19298, in post_pods\n    return self._call_api(endpoint, kwargs)\n  File \"/usr/local/lib/python3.9/site-packages/pypureclient/flasharray/FA_2_35/client.py\", line 38497, in _call_api\n    response = api_function(**kwargs)\n  File \"/usr/local/lib/python3.9/site-packages/pypureclient/flasharray/FA_2_35/api/pods_api.py\", line 1437, in api235_pods_post_with_http_info\n    raise TypeError(\"Missing the required parameter `pod` when calling `api235_pods_post`\")\nTypeError: Missing the required parameter `pod` when calling `api235_pods_post`\n",
  "exception": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1728971690.4138806-60-203037595067674/AnsiballZ_purefa_pod.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1728971690.4138806-60-203037595067674/AnsiballZ_purefa_pod.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1728971690.4138806-60-203037595067674/AnsiballZ_purefa_pod.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.purestorage.flasharray.plugins.modules.purefa_pod', init_globals=dict(_module_fqn='ansible_collections.purestorage.flasharray.plugins.modules.purefa_pod', _modlib_path=modlib_path),\n  File \"/usr/lib64/python3.9/runpy.py\", line 225, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib64/python3.9/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib64/python3.9/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_purestorage.flasharray.purefa_pod_payload_s6uajb_j/ansible_purestorage.flasharray.purefa_pod_payload.zip/ansible_collections/purestorage/flasharray/plugins/modules/purefa_pod.py\", line 747, in <module>\n  File \"/tmp/ansible_purestorage.flasharray.purefa_pod_payload_s6uajb_j/ansible_purestorage.flasharray.purefa_pod_payload.zip/ansible_collections/purestorage/flasharray/plugins/modules/purefa_pod.py\", line 727, in main\n  File \"/tmp/ansible_purestorage.flasharray.purefa_pod_payload_s6uajb_j/ansible_purestorage.flasharray.purefa_pod_payload.zip/ansible_collections/purestorage/flasharray/plugins/modules/purefa_pod.py\", line 321, in create_pod\n  File \"/usr/local/lib/python3.9/site-packages/pypureclient/flasharray/FA_2_35/client.py\", line 19298, in post_pods\n    return self._call_api(endpoint, kwargs)\n  File \"/usr/local/lib/python3.9/site-packages/pypureclient/flasharray/FA_2_35/client.py\", line 38497, in _call_api\n    response = api_function(**kwargs)\n  File \"/usr/local/lib/python3.9/site-packages/pypureclient/flasharray/FA_2_35/api/pods_api.py\", line 1437, in api235_pods_post_with_http_info\n    raise TypeError(\"Missing the required parameter `pod` when calling `api235_pods_post`\")\nTypeError: Missing the required parameter `pod` when calling `api235_pods_post`\n",
  "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
  "rc": 1,
  "_ansible_no_log": false,
  "changed": false
}

Let me know if you require anymore details.

Kind Regards,

spretorius85 avatar Oct 15 '24 09:10 spretorius85

@spretorius85 we are aware of a build issue for our EEs in quay. The latest version is now outdated and we are trying to resolve the build issue so that a current version of the EE can be uploaded to quay.

sdodsley avatar Oct 15 '24 11:10 sdodsley

@sdodsley thanks for the feedback. Please advice when it gets resolved.

spretorius85 avatar Oct 15 '24 12:10 spretorius85

Good day @sdodsley I would just like to check if there have perhaps been any progress regarding the above issue with the EEs in AAP?

Kind Regards,

spretorius85 avatar Nov 06 '24 12:11 spretorius85

Do to changes in EEs forced by Red Hat we are not longer creating our own EEs, however customers are free to create their own EEs using the latest collection

sdodsley avatar Nov 06 '24 13:11 sdodsley

Thanks for the update. So just to clarify the issue we are experiencing with creating a pod which works when running locally but getting that above error when we run in on the EE in AAP. Is that due to changes from Red Hat on the images? And also do you perhaps have any suggestions we can try to solve that issue? As we are building our own EE's using the pure collection and dependencies with Red Hat base images.

spretorius85 avatar Nov 07 '24 06:11 spretorius85