Skip to content

Commit

Permalink
Fix bug #61924 with API version check
Browse files Browse the repository at this point in the history
  • Loading branch information
sdodsley authored and abadger committed Sep 9, 2019
1 parent adb742d commit b844671
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
@@ -0,0 +1,2 @@
bugfixes:
- purefa_facts - Fix bug which causes module failure when selecting I(admins) or I(all) against an old Purity version
17 changes: 10 additions & 7 deletions lib/ansible/modules/storage/purestorage/purefa_facts.py
Expand Up @@ -336,6 +336,7 @@
from ansible.module_utils.pure import get_system, purefa_argument_spec


ADMIN_API_VERSION = '1.14'
S3_REQUIRED_API_VERSION = '1.16'
LATENCY_REQUIRED_API_VERSION = '1.16'
AC_REQUIRED_API_VERSION = '1.14'
Expand Down Expand Up @@ -456,13 +457,15 @@ def generate_config_dict(array):

def generate_admin_dict(array):
admin_facts = {}
admins = array.list_admins()
for admin in range(0, len(admins)):
admin_name = admins[admin]['name']
admin_facts[admin_name] = {
'type': admins[admin]['type'],
'role': admins[admin]['role'],
}
api_version = array._list_available_rest_versions()
if ADMIN_API_VERSION in api_version:
admins = array.list_admins()
for admin in range(0, len(admins)):
admin_name = admins[admin]['name']
admin_facts[admin_name] = {
'type': admins[admin]['type'],
'role': admins[admin]['role'],
}
return admin_facts


Expand Down

0 comments on commit b844671

Please sign in to comment.