mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-27 07:01:22 -07:00
[cloud][py3] Fix AttributeError in iam_policy on python3 (#30551)
This commit is contained in:
parent
a030472092
commit
875153d503
1 changed files with 4 additions and 4 deletions
|
@ -118,7 +118,6 @@ tasks:
|
||||||
|
|
||||||
'''
|
'''
|
||||||
import json
|
import json
|
||||||
import urllib
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import boto
|
import boto
|
||||||
|
@ -131,6 +130,7 @@ except ImportError:
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
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.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 import string_types
|
||||||
|
from ansible.module_utils.six.moves import urllib
|
||||||
|
|
||||||
|
|
||||||
def user_action(module, iam, name, policy_name, skip, pdoc, state):
|
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
|
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:
|
get_user_policy_result.policy_document) == pdoc:
|
||||||
policy_match = True
|
policy_match = True
|
||||||
matching_policies.append(pol)
|
matching_policies.append(pol)
|
||||||
|
@ -194,7 +194,7 @@ def role_action(module, iam, name, policy_name, skip, pdoc, state):
|
||||||
try:
|
try:
|
||||||
matching_policies = []
|
matching_policies = []
|
||||||
for pol in current_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:
|
get_role_policy_result.policy_document) == pdoc:
|
||||||
policy_match = True
|
policy_match = True
|
||||||
matching_policies.append(pol)
|
matching_policies.append(pol)
|
||||||
|
@ -239,7 +239,7 @@ def group_action(module, iam, name, policy_name, skip, pdoc, state):
|
||||||
policy_names]
|
policy_names]
|
||||||
matching_policies = []
|
matching_policies = []
|
||||||
for pol in current_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:
|
get_group_policy_result.policy_document) == pdoc:
|
||||||
policy_match = True
|
policy_match = True
|
||||||
matching_policies.append(pol)
|
matching_policies.append(pol)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue