Fix failure due to API version check

(cherry picked from commit dfe02d1ff4)
pull/62026/head
Simon Dodsley 5 years ago committed by Toshio Kuratomi
parent 97100bbea2
commit 93e8f4cef0

@ -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

@ -340,6 +340,7 @@ from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.pure import get_system, purefa_argument_spec from ansible.module_utils.pure import get_system, purefa_argument_spec
ADMIN_API_VERSION = '1.14'
S3_REQUIRED_API_VERSION = '1.16' S3_REQUIRED_API_VERSION = '1.16'
LATENCY_REQUIRED_API_VERSION = '1.16' LATENCY_REQUIRED_API_VERSION = '1.16'
AC_REQUIRED_API_VERSION = '1.14' AC_REQUIRED_API_VERSION = '1.14'
@ -461,14 +462,16 @@ def generate_config_dict(array):
def generate_admin_dict(array): def generate_admin_dict(array):
api_version = array._list_available_rest_versions()
admin_facts = {} admin_facts = {}
admins = array.list_admins() if ADMIN_API_VERSION in api_version:
for admin in range(0, len(admins)): admins = array.list_admins()
admin_name = admins[admin]['name'] for admin in range(0, len(admins)):
admin_facts[admin_name] = { admin_name = admins[admin]['name']
'type': admins[admin]['type'], admin_facts[admin_name] = {
'role': admins[admin]['role'], 'type': admins[admin]['type'],
} 'role': admins[admin]['role'],
}
return admin_facts return admin_facts

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

Loading…
Cancel
Save