Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check for correct API version before trying to execute #59205

Merged
merged 1 commit into from
Jul 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/ansible/modules/storage/purestorage/purefa_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.pure import get_system, purefa_argument_spec

MIN_REQUIRED_API_VERSION = '1.14'


def get_user(module, array):
"""Return Local User Account or None"""
Expand Down Expand Up @@ -200,6 +202,11 @@ def main():

state = module.params['state']
array = get_system(module)
api_version = array._list_available_rest_versions()

if MIN_REQUIRED_API_VERSION not in api_version:
module.fail_json(msg='FlashArray REST version not supported. '
'Minimum version required: {0}'.format(MIN_REQUIRED_API_VERSION))

if state == 'absent':
delete_user(module, array)
Expand Down