[cloud][py3] Fix AttributeError in iam_policy on python3 (#30551)

pull/30656/head
Vladimir Utenkov 7 years ago committed by Ryan Brown
parent a030472092
commit 875153d503

@ -118,7 +118,6 @@ tasks:
'''
import json
import urllib
try:
import boto
@ -131,6 +130,7 @@ except ImportError:
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ec2 import connect_to_aws, ec2_argument_spec, get_aws_connection_info, boto_exception
from ansible.module_utils.six import string_types
from ansible.module_utils.six.moves import urllib
def user_action(module, iam, name, policy_name, skip, pdoc, state):
@ -145,7 +145,7 @@ def user_action(module, iam, name, policy_name, skip, pdoc, state):
'''
urllib is needed here because boto returns url encoded strings instead
'''
if urllib.unquote(iam.get_user_policy(name, pol).
if urllib.parse.unquote(iam.get_user_policy(name, pol).
get_user_policy_result.policy_document) == pdoc:
policy_match = True
matching_policies.append(pol)
@ -194,7 +194,7 @@ def role_action(module, iam, name, policy_name, skip, pdoc, state):
try:
matching_policies = []
for pol in current_policies:
if urllib.unquote(iam.get_role_policy(name, pol).
if urllib.parse.unquote(iam.get_role_policy(name, pol).
get_role_policy_result.policy_document) == pdoc:
policy_match = True
matching_policies.append(pol)
@ -239,7 +239,7 @@ def group_action(module, iam, name, policy_name, skip, pdoc, state):
policy_names]
matching_policies = []
for pol in current_policies:
if urllib.unquote(iam.get_group_policy(name, pol).
if urllib.parse.unquote(iam.get_group_policy(name, pol).
get_group_policy_result.policy_document) == pdoc:
policy_match = True
matching_policies.append(pol)

Loading…
Cancel
Save