From 875153d50349de978ed96bf7b9b6abf1da57b5b5 Mon Sep 17 00:00:00 2001 From: Vladimir Utenkov Date: Wed, 20 Sep 2017 22:14:09 +0300 Subject: [PATCH] [cloud][py3] Fix AttributeError in iam_policy on python3 (#30551) --- lib/ansible/modules/cloud/amazon/iam_policy.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/cloud/amazon/iam_policy.py b/lib/ansible/modules/cloud/amazon/iam_policy.py index ce67e44780d..06268514c06 100644 --- a/lib/ansible/modules/cloud/amazon/iam_policy.py +++ b/lib/ansible/modules/cloud/amazon/iam_policy.py @@ -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)