Fix _hashable_policy for python3 (#53953)
Convert policy to string before using `startswith(str)` Fixes #53932
This commit is contained in:
parent
fc2ad0e9de
commit
64943e2f9d
1 changed files with 2 additions and 1 deletions
|
@ -561,10 +561,11 @@ def _hashable_policy(policy, policy_list):
|
||||||
tupleified = tuple(tupleified)
|
tupleified = tuple(tupleified)
|
||||||
policy_list.append(tupleified)
|
policy_list.append(tupleified)
|
||||||
elif isinstance(policy, string_types) or isinstance(policy, binary_type):
|
elif isinstance(policy, string_types) or isinstance(policy, binary_type):
|
||||||
|
policy = to_text(policy)
|
||||||
# convert root account ARNs to just account IDs
|
# convert root account ARNs to just account IDs
|
||||||
if policy.startswith('arn:aws:iam::') and policy.endswith(':root'):
|
if policy.startswith('arn:aws:iam::') and policy.endswith(':root'):
|
||||||
policy = policy.split(':')[4]
|
policy = policy.split(':')[4]
|
||||||
return [(to_text(policy))]
|
return [policy]
|
||||||
elif isinstance(policy, dict):
|
elif isinstance(policy, dict):
|
||||||
sorted_keys = list(policy.keys())
|
sorted_keys = list(policy.keys())
|
||||||
sorted_keys.sort()
|
sorted_keys.sort()
|
||||||
|
|
Loading…
Reference in a new issue