

def _read_rules(self, path):
    'Read and parse rules from path\n\n        Expect the file to contain a valid JSON structure.\n\n        :param path: path to the file\n        :return: loaded and valid dictionary with rules\n        :raises exception.CommandError: In case the file cannot be\n            accessed or the content is not a valid JSON.\n\n        Example of the content of the file:\n            [\n                {\n                    "local": [\n                        {\n                            "group": {\n                                "id": "85a868"\n                            }\n                        }\n                    ],\n                    "remote": [\n                        {\n                            "type": "orgPersonType",\n                            "any_one_of": [\n                                "Employee"\n                            ]\n                        },\n                        {\n                            "type": "sn",\n                            "any_one_of": [\n                                "Young"\n                            ]\n                        }\n                    ]\n                }\n            ]\n\n        '
    blob = utils.read_blob_file_contents(path)
    try:
        rules = json.loads(blob)
    except ValueError as e:
        raise exceptions.CommandError(('An error occurred when reading rules from file %s: %s' % (path, e)))
    else:
        return rules

dataset/ETHPy150Open dtroyer/python-openstackclient/openstackclient/identity/v3/mapping.py _RulesReader._read_rules/original