Fix user_agent string not getting set (#66914)

This commit is contained in:
Simon Dodsley 2020-01-31 12:50:53 -08:00 committed by GitHub
parent 9db0fb785d
commit 26175178ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- pure - fix incorrect user_string setting in module_utils file (https://github.com/ansible/ansible/pull/66914)

View file

@ -90,7 +90,8 @@ def get_blade(module):
blade.disable_verify_ssl()
try:
blade.login(api)
if API_AGENT_VERSION in blade.api_version.list_versions().versions:
versions = blade.api_version.list_versions().versions
if API_AGENT_VERSION in versions:
blade._api_client.user_agent = user_agent
except rest.ApiException as e:
module.fail_json(msg="Pure Storage FlashBlade authentication failed. Check your credentials")
@ -99,7 +100,8 @@ def get_blade(module):
blade.disable_verify_ssl()
try:
blade.login(environ.get('PUREFB_API'))
if API_AGENT_VERSION in blade.api_version.list_versions().versions:
versions = blade.api_version.list_versions().versions
if API_AGENT_VERSION in versions:
blade._api_client.user_agent = user_agent
except rest.ApiException as e:
module.fail_json(msg="Pure Storage FlashBlade authentication failed. Check your credentials")