PureStorage-OpenConnect / py-pure-client

Pure Storage Unified APIs Python Client
https://code.purestorage.com/py-pure-client/
BSD 2-Clause "Simplified" License
23 stars 29 forks source link

Issue with a internal CA chain length for ldap auth #56

Open glennbrown opened 1 year ago

glennbrown commented 1 year ago

I am using Ansible and when running purefa_info module the py-pure-client fails with an error about the length our internal ca chain length. I have re-produced on multiple Pure arrays and when I remove the CA chain it resolves the issue.

fatal: [localhost]: FAILED! => {"changed": false "module_stderr": "/usr/local/Cellar/ansible/7.3.0/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'us-wcp-sp-pur-dev-01.qvcdev.qvc.net'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n warnings.warn(\n/usr/local/Cellar/ansible/7.3.0/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'us-wcp-sp-pur-dev-01.qvcdev.qvc.net'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n warnings.warn(\n/usr/local/Cellar/ansible/7.3.0/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'us-wcp-sp-pur-dev-01.qvcdev.qvc.net'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n warnings.warn(\n/usr/local/Cellar/ansible/7.3.0/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'us-wcp-sp-pur-dev-01.qvcdev.qvc.net'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n warnings.warn(\n/usr/local/Cellar/ansible/7.3.0/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'us-wcp-sp-pur-dev-01.qvcdev.qvc.net'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n warnings.warn(\n/usr/local/Cellar/ansible/7.3.0/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'us-wcp-sp-pur-dev-01.qvcdev.qvc.net'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n warnings.warn(\n/usr/local/Cellar/ansible/7.3.0/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'us-wcp-sp-pur-dev-01.qvcdev.qvc.net'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n warnings.warn(\n/usr/local/Cellar/ansible/7.3.0/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'us-wcp-sp-pur-dev-01.qvcdev.qvc.net'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n warnings.warn(\n/usr/local/Cellar/ansible/7.3.0/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'us-wcp-sp-pur-dev-01.qvcdev.qvc.net'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n warnings.warn(\n/usr/local/Cellar/ansible/7.3.0/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'us-wcp-sp-pur-dev-01.qvcdev.qvc.net'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n warnings.warn(\n/usr/local/Cellar/ansible/7.3.0/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'us-wcp-sp-pur-dev-01.qvcdev.qvc.net'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n warnings.warn(\n/usr/local/Cellar/ansible/7.3.0/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'us-wcp-sp-pur-dev-01.qvcdev.qvc.net'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n warnings.warn(\nTraceback (most recent call last):\n File \"/Users/q1431233/.ansible/tmp/ansible-tmp-1680102650.258016-35382-63609457564513/AnsiballZ_purefa_info.py\" line 107 in <module>\n _ansiballz_main()\n File \"/Users/q1431233/.ansible/tmp/ansible-tmp-1680102650.258016-35382-63609457564513/AnsiballZ_purefa_info.py\" line 99 in _ansiballz_main\n invoke_module(zipped_mod temp_path ANSIBALLZ_PARAMS)\n File \"/Users/q1431233/.ansible/tmp/ansible-tmp-1680102650.258016-35382-63609457564513/AnsiballZ_purefa_info.py\" line 47 in invoke_module\n runpy.run_module(mod_name='ansible_collections.purestorage.flasharray.plugins.modules.purefa_info' init_globals=dict(_module_fqn='ansible_collections.purestorage.flasharray.plugins.modules.purefa_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 \"/var/folders/fb/vw9q4b9d5xs9wmrsx3s56cdjsggj6w/T/ansible_purefa_info_payload_7fu7rr7h/ansible_purefa_info_payload.zip/ansible_collections/purestorage/flasharray/plugins/modules/purefa_info.py\" line 2083 in <module>\n File \"/var/folders/fb/vw9q4b9d5xs9wmrsx3s56cdjsggj6w/T/ansible_purefa_info_payload_7fu7rr7h/ansible_purefa_info_payload.zip/ansible_collections/purestorage/flasharray/plugins/modules/purefa_info.py\" line 2008 in main\n File \"/var/folders/fb/vw9q4b9d5xs9wmrsx3s56cdjsggj6w/T/ansible_purefa_info_payload_7fu7rr7h/ansible_purefa_info_payload.zip/ansible_collections/purestorage/flasharray/plugins/modules/purefa_info.py\" line 583 in generate_config_dict\n File \"/usr/local/lib/python3.11/site-packages/pypureclient/flasharray/FA_2_8/client.py\" line 6849 in get_directory_services\n return self._call_api(endpoint kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.11/site-packages/pypureclient/flasharray/FA_2_8/client.py\" line 26051 in _call_api\n response = api_function(**kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.11/site-packages/pypureclient/flasharray/FA_2_8/api/directory_services_api.py\" line 132 in api28_directory_services_get_with_http_info\n return self.api_client.call_api(\n ^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.11/site-packages/pypureclient/flasharray/FA_2_8/api_client.py\" line 327 in call_api\n return self.__call_api(resource_path method \n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.11/site-packages/pypureclient/flasharray/FA_2_8/api_client.py\" line 170 in __call_api\n return_data = self.deserialize(response_data response_type)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.11/site-packages/pypureclient/flasharray/FA_2_8/api_client.py\" line 243 in deserialize\n return self.__deserialize(data response_type)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.11/site-packages/pypureclient/flasharray/FA_2_8/api_client.py\" line 282 in __deserialize\n return self.__deserialize_model(data klass)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.11/site-packages/pypureclient/flasharray/FA_2_8/api_client.py\" line 632 in __deserialize_model\n kwargs[attr] = self.__deserialize(value attr_type)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.11/site-packages/pypureclient/flasharray/FA_2_8/api_client.py\" line 259 in __deserialize\n return [self.__deserialize(sub_data sub_kls)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.11/site-packages/pypureclient/flasharray/FA_2_8/api_client.py\" line 259 in <listcomp>\n return [self.__deserialize(sub_data sub_kls)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.11/site-packages/pypureclient/flasharray/FA_2_8/api_client.py\" line 282 in __deserialize\n return self.__deserialize_model(data klass)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.11/site-packages/pypureclient/flasharray/FA_2_8/api_client.py\" line 634 in __deserialize_model\n instance = klass(**kwargs)\n ^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.11/site-packages/pypureclient/flasharray/FA_2_8/models/directory_service.py\" line 96 in __init__\n self.ca_certificate = ca_certificate\n ^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.11/site-packages/pypureclient/flasharray/FA_2_8/models/directory_service.py\" line 113 in __setattr__\n raise ValueError(\"Invalid value forca_certificate length must be less than or equal to3000\")\nValueError: Invalid value forca_certificate length must be less than or equal to3000\n" "module_stdout": "" "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error" "rc": 1}

ToMo999 commented 1 year ago

same problem here. Can you please explain your workaround? "I remove the CA chain it resolves the issue"