def _compare_acl(current, desired, region, key, keyid, profile): ''' ACLs can be specified using macro-style names that get expanded to something more complex. There's no predictable way to reverse it. So expand all syntactic sugar in our input, and compare against that rather than the input itself. ''' ocid = _get_canonical_id(region, key, keyid, profile) return json_objs_equal(current, _acl_to_grant(desired, ocid))
def _compare_replication(current, desired, region, key, keyid, profile): ''' Replication accepts a non-ARN role name, but always returns an ARN ''' if desired is not None and desired.get('Role'): desired = deepcopy(desired) desired['Role'] = _get_role_arn(desired['Role'], region=region, key=key, keyid=keyid, profile=profile) return json_objs_equal(current, desired)
def _compare_policy(current, desired, region, key, keyid, profile): ''' Policy discription is always returned as a JSON string. Comparison should be object-to-object, since order is not significant in JSON ''' if isinstance(desired, string_types): desired = json.loads(desired) if current is not None: temp = current.get('Policy') if isinstance(temp, string_types): current = {'Policy': json.loads(temp)} else: current = None return json_objs_equal(current, desired)
def _compare_json(current, desired, region, key, keyid, profile): return json_objs_equal(current, desired)