purefa_info: Fix failure due to API version check (#61925)

This commit is contained in:
Simon Dodsley 2019-09-09 03:14:46 -04:00 committed by René Moser
parent 92099d7f2f
commit df49a9e58c
3 changed files with 23 additions and 14 deletions

View file

@ -0,0 +1,3 @@
bugfixes:
- purefa_info - Fix missing API version check when calling I(admins) or I(all) as the subset
- _purefa_facts - Fix missing API version check when calling I(admins) or I(all) as the subset

View file

@ -340,6 +340,7 @@ from ansible.module_utils.basic import AnsibleModule
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'
@ -461,14 +462,16 @@ def generate_config_dict(array):
def generate_admin_dict(array):
api_version = array._list_available_rest_versions()
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'],
}
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

View file

@ -408,6 +408,7 @@ from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.pure import get_system, purefa_argument_spec
import time
ADMIN_API_VERSION = '1.14'
S3_REQUIRED_API_VERSION = '1.16'
LATENCY_REQUIRED_API_VERSION = '1.16'
AC_REQUIRED_API_VERSION = '1.14'
@ -530,13 +531,15 @@ def generate_config_dict(array):
def generate_admin_dict(array):
admin_info = {}
admins = array.list_admins()
for admin in range(0, len(admins)):
admin_name = admins[admin]['name']
admin_info[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_info[admin_name] = {
'type': admins[admin]['type'],
'role': admins[admin]['role'],
}
return admin_info