Fix UnboundLocalError if 'access_key_ids' not supplied
'key_ids' is referenced before it is assigned, causing the module to fail with a UnboundLocalError instead of failing gracefully with a helpful error message. This very small patch moves the assignment of 'key_ids' to before the variable is referenced.
This commit is contained in:
parent
98322a777f
commit
c1787da7ff
1 changed files with 1 additions and 1 deletions
|
@ -534,12 +534,12 @@ def main():
|
||||||
new_path = module.params.get('new_path')
|
new_path = module.params.get('new_path')
|
||||||
key_count = module.params.get('key_count')
|
key_count = module.params.get('key_count')
|
||||||
key_state = module.params.get('access_key_state')
|
key_state = module.params.get('access_key_state')
|
||||||
|
key_ids = module.params.get('access_key_ids')
|
||||||
if key_state:
|
if key_state:
|
||||||
key_state = key_state.lower()
|
key_state = key_state.lower()
|
||||||
if any([n in key_state for n in ['active', 'inactive']]) and not key_ids:
|
if any([n in key_state for n in ['active', 'inactive']]) and not key_ids:
|
||||||
module.fail_json(changed=False, msg="At least one access key has to be defined in order"
|
module.fail_json(changed=False, msg="At least one access key has to be defined in order"
|
||||||
" to use 'active' or 'inactive'")
|
" to use 'active' or 'inactive'")
|
||||||
key_ids = module.params.get('access_key_ids')
|
|
||||||
|
|
||||||
if iam_type == 'user' and module.params.get('password') is not None:
|
if iam_type == 'user' and module.params.get('password') is not None:
|
||||||
pwd = module.params.get('password')
|
pwd = module.params.get('password')
|
||||||
|
|
Loading…
Reference in a new issue