replace uses of sort_json_policy_dict with compare_policies (#52943)

* replace uses of sort_json_policy_dict with compare_policies which is compatible with Python 3 and remove sort_json_policy_dict from the AWS guidelines since it only works on Python 2

* Sort any lists containing only strings

* Sort the original policy too
This commit is contained in:
Sloane Hertel
2019-02-28 16:09:00 -06:00
committed by Sam Doran
parent 2a98faee2b
commit 8a02f894a6
4 changed files with 21 additions and 16 deletions

View File

@@ -563,15 +563,6 @@ if there are. This recursively sorts the dicts and makes them hashable before co
This method should be used any time policies are being compared so that a change in order
doesn't result in unnecessary changes.
#### sort_json_policy_dict
Pass any JSON policy dict to this function in order to sort any list contained therein. This is
useful because AWS rarely return lists in the same order that they were submitted so without this
function, comparison of identical policies returns false.
Note if your goal is to check if two policies are the same you're better to use the `compare_policies`
helper which sorts recursively.
#### compare_aws_tags
Pass two dicts of tags and an optional purge parameter and this function will return a dict