From 26175178ee639d3b0e0cd14159aa61d8e8c99b6b Mon Sep 17 00:00:00 2001 From: Simon Dodsley Date: Fri, 31 Jan 2020 12:50:53 -0800 Subject: [PATCH] Fix user_agent string not getting set (#66914) --- changelogs/fragments/66914-purefa_user_string.yaml | 2 ++ lib/ansible/module_utils/pure.py | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/66914-purefa_user_string.yaml diff --git a/changelogs/fragments/66914-purefa_user_string.yaml b/changelogs/fragments/66914-purefa_user_string.yaml new file mode 100644 index 00000000000..16ff2dd3782 --- /dev/null +++ b/changelogs/fragments/66914-purefa_user_string.yaml @@ -0,0 +1,2 @@ +bugfixes: + - pure - fix incorrect user_string setting in module_utils file (https://github.com/ansible/ansible/pull/66914) diff --git a/lib/ansible/module_utils/pure.py b/lib/ansible/module_utils/pure.py index 9e94c3e6573..019c11add22 100644 --- a/lib/ansible/module_utils/pure.py +++ b/lib/ansible/module_utils/pure.py @@ -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")