| Index: components/policy/resources/PRESUBMIT.py
|
| diff --git a/components/policy/resources/PRESUBMIT.py b/components/policy/resources/PRESUBMIT.py
|
| index 3870875aa379667a0dc5c6d59e95347b8e3934b3..19ea0ec12606960f27f1f513864f564e8b6e41e1 100644
|
| --- a/components/policy/resources/PRESUBMIT.py
|
| +++ b/components/policy/resources/PRESUBMIT.py
|
| @@ -16,14 +16,17 @@ def _GetPolicyTemplates(template_path):
|
| # is actually maintained as a python dictionary.
|
| with open(template_path) as f:
|
| template_data = eval(f.read(), {})
|
| - policies = ( policy
|
| + try:
|
| + policies = ( policy
|
| + for policy in template_data['policy_definitions']
|
| + if policy['type'] != 'group' )
|
| + groups = ( policy['policies']
|
| for policy in template_data['policy_definitions']
|
| - if policy['type'] != 'group' )
|
| - groups = ( policy['policies']
|
| - for policy in template_data['policy_definitions']
|
| - if policy['type'] == 'group' )
|
| - subpolicies = ( policy for group in groups for policy in group )
|
| - return list(itertools.chain(policies, subpolicies))
|
| + if policy['type'] == 'group' )
|
| + subpolicies = ( policy for group in groups for policy in group )
|
| + return list(itertools.chain(policies, subpolicies))
|
| + except:
|
| + return list()
|
|
|
| def _CheckPolicyTemplatesSyntax(input_api, output_api):
|
| local_path = input_api.PresubmitLocalPath()
|
|
|