Commit 6c8601ff authored by Takumi Fujimoto's avatar Takumi Fujimoto Committed by Commit Bot

Revert "Include compatibility checks when submitting policy_templates.json."

This reverts commit d44d94c6.

Reason for revert: I think this is the cause for this tree-closing failure:
https://ci.chromium.org/p/chromium/builders/ci/win32-archive-rel/7768

Original change's description:
> Include compatibility checks when submitting policy_templates.json.
> 
> This will change the presubmit checks for policy_templates.json to
> ensure that policy changes are backwards compatible with policies
> definitions that have already shipped.
> 
> Bug: 1026330
> Change-Id: If054d2376397432c66d948eaf0d2d42d5db13a0b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1925190
> Reviewed-by: Sergey Poromov <poromov@chromium.org>
> Reviewed-by: Julian Pastarmov <pastarmovj@chromium.org>
> Commit-Queue: Tien Mai <tienmai@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#721123}

TBR=pastarmovj@chromium.org,poromov@chromium.org,tienmai@chromium.org

Change-Id: I0ac66ee107a0ad25675e149192b47868653c525c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1026330
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1949265Reviewed-by: default avatarTakumi Fujimoto <takumif@chromium.org>
Commit-Queue: Takumi Fujimoto <takumif@chromium.org>
Cr-Commit-Position: refs/heads/master@{#721139}
parent 4d66264d
...@@ -35,42 +35,8 @@ def _CheckPolicyTemplatesSyntax(input_api, output_api): ...@@ -35,42 +35,8 @@ def _CheckPolicyTemplatesSyntax(input_api, output_api):
device_policy_proto_path = input_api.os_path.join( device_policy_proto_path = input_api.os_path.join(
local_path, '../proto/chrome_device_policy.proto') local_path, '../proto/chrome_device_policy.proto')
args = ["--device_policy_proto_path=" + device_policy_proto_path] args = ["--device_policy_proto_path=" + device_policy_proto_path]
root = input_api.change.RepositoryRoot()
current_version = None
original_file_contents = None
# Check if there is a tag that allows us to bypass compatibility checks.
# This can be used in situations where there is a bug in the validation
# code or if a policy change needs to urgently be submitted.
if not input_api.change.tags.get('BYPASS_POLICY_COMPATIBILITY_CHECK'):
# Get the current version from the VERSION file so that we can check
# which policies are un-released and thus can be changed at will.
try:
version_path = input_api.os_path.join(
root, 'chrome', 'VERSION')
with open(version_path, "rb") as f:
current_version = int(f.readline().split("=")[1])
print ('Checking policies against current version: ' +
current_version)
except:
pass
# Get the original file contents of the policy file so that we can check
# the compatibility of template changes in it
template_path = input_api.os_path.join(
root, 'components', 'policy', 'resources', 'policy_templates.json')
affected_files = input_api.change.AffectedFiles()
template_affected_file = next(iter(f \
for f in affected_files if f.AbsoluteLocalPath() == template_path))
if template_affected_file is not None:
original_file_contents = \
'\n'.join(template_affected_file.OldContents())
checker = syntax_check_policy_template_json.PolicyTemplateChecker() checker = syntax_check_policy_template_json.PolicyTemplateChecker()
if checker.Run(args, filepath, if checker.Run(args, filepath) > 0:
original_file_contents, current_version) > 0:
return [output_api.PresubmitError('Syntax error(s) in file:', return [output_api.PresubmitError('Syntax error(s) in file:',
[filepath])] [filepath])]
finally: finally:
......
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