Fix bug in iam_role (#22618)

This commit is contained in:
Jonathan Davila 2017-05-14 17:29:44 -04:00 committed by GitHub
parent f9b4499082
commit 6410e13903

View file

@ -190,7 +190,7 @@ def create_or_update_role(connection, module):
changed = False
# Get role
role = get_role(connection, params['RoleName'])
role = get_role(connection, params['RoleName'], module)
# If role is None, create it
if role is None:
@ -258,7 +258,7 @@ def create_or_update_role(connection, module):
connection.add_role_to_instance_profile(InstanceProfileName=params['RoleName'], RoleName=params['RoleName'])
# Get the role again
role = get_role(connection, params['RoleName'])
role = get_role(connection, params['RoleName'], module)
role['attached_policies'] = get_attached_policy_list(connection, params['RoleName'])
module.exit_json(changed=changed, iam_role=camel_dict_to_snake_dict(role))
@ -269,7 +269,7 @@ def destroy_role(connection, module):
params = dict()
params['RoleName'] = module.params.get('name')
if get_role(connection, params['RoleName']):
if get_role(connection, params['RoleName'], module):
# We need to remove any instance profiles from the role before we delete it
try:
@ -301,7 +301,7 @@ def destroy_role(connection, module):
module.exit_json(changed=True)
def get_role(connection, name):
def get_role(connection, name, module):
params = dict()
params['RoleName'] = name