Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
marknet15 committed Oct 9, 2021
1 parent 0ba03ea commit 3ef4fa6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion plugins/modules/iam_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,9 @@ def compare_assume_role_policy_doc(current_policy_doc, new_policy_doc):
return False


@AWSRetry.jittered_backoff()
def _list_policies(connection):
paginator = connection.get_paginator('list_policies', aws_retry=True)
paginator = connection.get_paginator('list_policies')
return paginator.paginate().build_full_result()['Policies']


Expand Down
16 changes: 9 additions & 7 deletions plugins/modules/iam_role_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,23 +159,25 @@
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import boto3_tag_list_to_ansible_dict


@AWSRetry.jittered_backoff()
def list_iam_roles_with_backoff(client, **kwargs):
paginator = client.get_paginator('list_roles', aws_retry=True)
paginator = client.get_paginator('list_roles')
return paginator.paginate(**kwargs).build_full_result()


@AWSRetry.jittered_backoff()
def list_iam_role_policies_with_backoff(client, role_name):
paginator = client.get_paginator('list_role_policies', aws_retry=True)
paginator = client.get_paginator('list_role_policies')
return paginator.paginate(RoleName=role_name).build_full_result()['PolicyNames']


@AWSRetry.jittered_backoff()
def list_iam_attached_role_policies_with_backoff(client, role_name):
paginator = client.get_paginator('list_attached_role_policies', aws_retry=True)
paginator = client.get_paginator('list_attached_role_policies')
return paginator.paginate(RoleName=role_name).build_full_result()['AttachedPolicies']


@AWSRetry.jittered_backoff()
def list_iam_instance_profiles_for_role_with_backoff(client, role_name):
paginator = client.get_paginator('list_instance_profiles_for_role', aws_retry=True)
paginator = client.get_paginator('list_instance_profiles_for_role')
return paginator.paginate(RoleName=role_name).build_full_result()['InstanceProfiles']


Expand Down Expand Up @@ -206,7 +208,7 @@ def describe_iam_roles(module, client):
path_prefix = module.params['path_prefix']
if name:
try:
roles = [client.get_role(aws_retry=True, RoleName=name)['Role']]
roles = [client.get_role(RoleName=name, aws_retry=True)['Role']]
except is_boto3_error_code('NoSuchEntity'):
return []
except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: # pylint: disable=duplicate-except
Expand Down

0 comments on commit 3ef4fa6

Please sign in to comment.