Commit 8aa1a171 authored by Adam Langley's avatar Adam Langley Committed by Commit Bot

Fix update_policies.py

I think update_policies.py broke after
https://chromium-review.googlesource.com/657402, which changed the
contents of a group's policy list to be a list of strings, rather than a
list of policies.

Change-Id: I2f1e8ff415ebadf8c2dd44bcb476a0cce7600cf6
Bug: None
Reviewed-on: https://chromium-review.googlesource.com/747634Reviewed-by: default avatarRobert Kaplow <rkaplow@chromium.org>
Commit-Queue: Adam Langley <agl@chromium.org>
Cr-Commit-Position: refs/heads/master@{#512937}
parent a344d93a
......@@ -36,22 +36,6 @@ class UserError(Exception):
return self.args[0]
def FlattenPolicies(policy_definitions, policy_list):
"""Appends a list of policies defined in |policy_definitions| to
|policy_list|, flattening subgroups.
Args:
policy_definitions: A list of policy definitions and groups, as in
policy_templates.json file.
policy_list: A list that has policy definitions appended to it.
"""
for policy in policy_definitions:
if policy['type'] == 'group':
FlattenPolicies(policy['policies'], policy_list)
else:
policy_list.append(policy)
def UpdateHistogramDefinitions(policy_templates, doc):
"""Sets the children of <enum name="EnterprisePolicies" ...> node in |doc| to
values generated from policy ids contained in |policy_templates|.
......@@ -80,8 +64,8 @@ def UpdateHistogramDefinitions(policy_templates, doc):
policy_enum_node.appendChild(doc.createComment(comment))
# Add values generated from policy templates.
ordered_policies = []
FlattenPolicies(policy_templates['policy_definitions'], ordered_policies)
ordered_policies = [x for x in policy_templates['policy_definitions']
if x['type'] != 'group']
ordered_policies.sort(key=lambda policy: policy['id'])
for policy in ordered_policies:
node = doc.createElement('int')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment