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):
device_policy_proto_path = input_api.os_path.join(
local_path, '../proto/chrome_device_policy.proto')
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()
if checker.Run(args, filepath,
original_file_contents, current_version) > 0:
if checker.Run(args, filepath) > 0:
return [output_api.PresubmitError('Syntax error(s) in file:',
[filepath])]
finally:
......
......@@ -81,63 +81,6 @@ TOTAL_DEVICE_POLICY_EXTERNAL_DATA_MAX_SIZE = 1024 * 1024 * 100
# description might exceed this limit, so a lower limit of is used instead.
POLICY_DESCRIPTION_LENGTH_SOFT_LIMIT = 3500
# Dictionaries that define how the checks can determine if a change to a policy
# value are backwards compatible.
# Defines specific keys in specific types that have custom validation functions
# for checking if a change to the value is a backwards compatible change.
# For instance increasing the 'maxmimum' value for an integer is less
# restrictive than decreasing it.
CUSTOM_VALUE_CHANGE_VALIDATION_PER_TYPE = {
'integer': {
'minimum': lambda old_value, new_value: new_value <= old_value,
'maximum': lambda old_value, new_value: new_value >= old_value
}
}
# Defines keys per type that can simply be removed in a newer version of a
# policy. For example, removing a 'required' field makes a policy schema less
# restrictive.
# This dictionary allows us to state that the given key can be totally removed
# when checking for a particular type. Or if the key usually represents an
# array of values, it states that entries in the array can be removed. Normally
# no array value can be removed in a policy change if we want to keep it
# backwards compatible.
REMOVABLE_SCHEMA_VALUES_PER_TYPE = {
'integer': ['minimum', 'maximum'],
'string': ['pattern'],
'object': ['required']
}
# Defines keys per type that that can be changed in any way without affecting
# policy compatibility (for example we can change, remove or add a 'description'
# to a policy schema without causings incompatibilities).
MODIFIABLE_SCHEMA_KEYS_PER_TYPE = {
'integer': ['description', 'sensitiveValue'],
'string': ['description', 'sensitiveValue'],
'object': ['description', 'sensitiveValue']
}
# Defines keys per type that themselves define a further dictionary of
# properties each with their own schemas. For example, 'object' types define
# a 'properties' key that list all the possible keys in the object.
KEYS_DEFINING_PROPERTY_DICT_SCHEMAS_PER_TYPE = {
'object': ['properties', 'patternProperties']
}
# Defines keys per type that themselves define a schema. For example, 'array'
# types define an 'items' key defines the scheme for each item in the array.
KEYS_DEFINING_SCHEMAS_PER_TYPE = {
'object': ['additionalProperties'],
'array': ['items']
}
# Helper function to determine if a given type defines a key in a dictionary
# that is used to condition certain backwards compatibility checks.
def IsKeyDefinedForTypeInDictionary(type, key, key_per_type_dict):
return type in key_per_type_dict and key in key_per_type_dict[type]
class PolicyTemplateChecker(object):
......@@ -498,27 +441,9 @@ class PolicyTemplateChecker(object):
supported_on = self._CheckContains(policy, 'supported_on', list)
if supported_on is not None:
for s in supported_on:
(
supported_on_platform,
supported_on_from,
supported_on_to,
) = self._GetSupportedVersionPlatformAndRange(s)
if not isinstance(supported_on_platform,
str) or not supported_on_platform:
self._Error(
'Entries in "supported_on" must have a valid target before the '
'":".', 'policy', policy, supported_on)
elif not isinstance(supported_on_from, int):
self._Error(
'Entries in "supported_on" must have a valid starting '
'supported version after the ":".', 'policy', policy,
supported_on)
elif isinstance(supported_on_to,
int) and supported_on_to < supported_on_from:
self._Error(
'Entries in "supported_on" that have an ending '
'supported version must have a version larger than the '
'starting supported version.', 'policy', policy, supported_on)
if not isinstance(s, str):
self._Error('Entries in "supported_on" must be strings.', 'policy',
policy, supported_on)
# Each policy must have a 'features' dict.
features = self._CheckContains(policy, 'features', dict)
......@@ -717,468 +642,6 @@ class PolicyTemplateChecker(object):
self.warning_count += 1
print 'In message %s: Warning: Unknown key: %s' % (key, vkey)
def _GetSupportedVersionPlatformAndRange(self, supported_on):
(supported_on_platform, supported_on_versions) = supported_on.split(":")
(supported_on_from, supported_on_to) = supported_on_versions.split("-")
return supported_on_platform, (
int(supported_on_from) if supported_on_from else None), (
int(supported_on_to) if supported_on_to else None)
def _CheckPolicyIsReleasedToStableBranch(self, original_policy,
current_version):
'''
Given the unchanged policy definition, check if it was already released to
a stable branch (not necessarily fully released publicly to stable) by
checking the current_version found in the code at head.
|original_policy|: The policy definition as it appeared in the unmodified
policy templates file.
|current_version|: The current major version of the branch as stored in
chrome/VERSION. This is usually the master version, but may also be a
stable version number if we are trying to submit a change into a stable
cut branch.
'''
if 'future' in original_policy and original_policy['future']:
return False
if all(original_supported_version >= current_version
for original_supported_version in (
self._GetSupportedVersionPlatformAndRange(supported_on)[1]
for supported_on in original_policy['supported_on'])):
return False
return True
def _CheckSingleSchemaValueIsCompatible(
self, old_schema_value, new_schema_value, custom_value_validation):
'''
Checks if a |new_schema_value| in a schema is compatible with an
|old_schema_value| in a schema. The check will either use the provided
|custom_value_validation| if any or do a normal equality comparison.
'''
return (custom_value_validation == None and
old_schema_value == new_schema_value) or (
custom_value_validation != None and
custom_value_validation(old_schema_value, new_schema_value))
def _CheckSchemaValueIsCompatible(self, schema_key_path, old_schema_value,
new_schema_value, only_removals_allowed,
custom_value_validation):
'''
Checks if two leaf schema values defined by |old_schema_value| and
|new_schema_value| are compatible with each other given certain conditions
concerning removal (|only_removals_allowed|) and also for custom
compatibility validation (|custom_value_validation|). The leaf schema should
never be a dictionary type.
|schema_key_path|: Used for error reporting, this is the current path in the
policy schema that we are processing represented as a list of paths.
|old_schema_value|: The value of the schema property in the original policy
templates file.
|new_schema_value|: The value of the schema property in the modified policy
templates file.
|only_removals_allowed|: Specifies whether the schema value can be removed
in the modified policy templates file. For list type schema values, this
flag will also allow removing some entries in the list while keeping other
parts.
|custom_value_validation|: Custom validation function used to compare the
old and new values to see if they are compatible. If None is provided then
an equality comparison is used.
'''
current_schema_key = '/'.join(schema_key_path)
# If there is no new value but an old one exists, generally this is
# considered an incompatibility and should be reported unless removals are
# allowed for this value.
if (new_schema_value == None):
if not only_removals_allowed:
self._Error(
'Value in policy schema path \'%s\' was removed in new schema '
'value.' % (current_schema_key))
return
# Both old and new values must be of the same type.
if type(old_schema_value) != type(new_schema_value):
self._Error(
'Value in policy schema path \'%s\' is of type \'%s\' but value in '
'schema is of type \'%s\'.' % (current_schema_key,
type(old_schema_value).__name__,
type(new_schema_value).__name__))
# We are checking a leaf schema key and do not expect to ever get a
# dictionary value at this level.
if (type(old_schema_value) is dict):
self._Error(
'Value in policy schema path \'%s\' had an unexpected type: \'%s\'.' %
(current_schema_key, type(old_schema_value).__name__))
# We have a list type schema value. In general additions to the list are
# allowed (e.g. adding a new enum value) but removals from the lists are
# not allowed. Also additions to the list must only occur at the END of the
# old list and not in the middle.
elif (type(old_schema_value) is list):
# If only removal from the list is allowed check that there are no new
# values and that only old values are removed. Since we are enforcing
# strict ordering we can check the lists sequentially for this condition.
if only_removals_allowed:
j = 0
i = 0
# For every old value, check that it either exists in the new value in
# the same order or was removed. This loop only iterates sequentially
# on both lists.
while i < len(old_schema_value) and j < len(new_schema_value):
# Keep looking in the old value until we find a matching new_value at
# our current position in the list or until we reach the end of the
# old values.
while not self._CheckSingleSchemaValueIsCompatible(
old_schema_value[i], new_schema_value[j],
custom_value_validation):
i += 1
if i >= len(old_schema_value):
break
# Here either we've found the matching old value so that we can say
# the new value matches and move to the next new value (j += 1) and
# the next old value (i += 1) to check, or we have exhausted the old
# value list and can exit the loop.
if i < len(old_schema_value):
j += 1
i += 1
# Everything we have not processed in the new value list is in error
# because only allow removal in this list.
while j < len(new_schema_value):
self._Error(
'Value \'%s\' in policy schema path \'%s/[%s]\' was added which '
'is not allowed.' % (str(new_schema_value[j]), current_schema_key,
j))
j += 1
else:
# If removals are not allowed we should be able to add to the list, but
# only at the end. We only need to check that all the old values appear
# in the same order in the new value as in the old value. Everything
# added after the end of the old value list is allowed.
# If the new value list is shorter than the old value list we will end
# up with calls to _CheckSchemaValueIsCompatible where
# new_schema_value == None and this will raise an error on the first
# check in the function.
for i in range(len(old_schema_value)):
self._CheckSchemaValueIsCompatible(
schema_key_path + ['[' + str(i) + ']'], old_schema_value[i],
new_schema_value[i] if len(new_schema_value) > i else None,
only_removals_allowed, custom_value_validation)
# For non list values, we compare the two values against each other with
# the custom_value_validation or standard equality comparisons.
elif not self._CheckSingleSchemaValueIsCompatible(
old_schema_value, new_schema_value, custom_value_validation):
self._Error(
'Value in policy schema path \'%s\' was changed from \'%s\' to '
'\'%s\' which is not allowed.' %
(current_schema_key, str(old_schema_value), str(new_schema_value)))
def _CheckSchemasAreCompatible(self, schema_key_path, old_schema, new_schema):
current_schema_key = '/'.join(schema_key_path)
'''
Checks if two given schemas are compatible with each other.
This function will raise errors if it finds any incompatibilities between
the |old_schema| and |new_schema|.
|schema_key_path|: Used for error reporting, this is the current path in the
policy schema that we are processing represented as a list of paths.
|old_schema|: The full contents of the schema as found in the original
policy templates file.
|new_schema|: The full contents of the new schema as found (if any) in the
modified policy templates file.
'''
# If the old schema was present and the new one is no longer present, this
# is an error. This case can occur while we are recursing through various
# 'object' type schemas.
if (new_schema is None):
self._Error(
'Policy schema path \'%s\' in old schema was removed in newer '
'version.' % (current_schema_key))
return
# Both old and new schema information must be in dict format.
if type(old_schema) is not dict:
self._Error(
'Policy schema path \'%s\' in old policy is of type \'%s\', it must '
'be dict type.' % (current_schema_key, type(old_schema)))
if type(new_schema) is not dict:
self._Error(
'Policy schema path \'%s\' in new policy is of type \'%s\', it must '
'be dict type.' % (current_schema_key, type(new_schema)))
# Both schemas must either have a 'type' key or not. This covers the case
# where the scheme is merely a '$ref'
if ('type' in old_schema) != ('type' in new_schema):
self._Error(
'Mismatch in type definition for old schema and new schema for '
'policy schema path \'%s\'. One schema defines a type while the other'
' does not.' % (current_schema_key, old_schema['type'],
new_schema['type']))
return
# For schemes that define a 'type', make sure they match.
schema_type = None
if ('type' in old_schema):
if (old_schema['type'] != new_schema['type']):
self._Error(
'Policy schema path \'%s\' in old schema is of type \'%s\' but '
'new schema is of type \'%s\'.' %
(current_schema_key, old_schema['type'], new_schema['type']))
return
schema_type = old_schema['type']
# If a schema does not have 'type' we will simply end up comparing every
# key/value pair for exact matching (the final else in this loop). This will
# ensure that '$ref' type schemas match.
for old_key, old_value in old_schema.items():
# 'type' key was already checked above.
if (old_key == 'type'):
continue
# If the schema key is marked as modifiable (e.g. 'description'), then
# no validation is needed. Anything can be done to it include removal.
if IsKeyDefinedForTypeInDictionary(schema_type, old_key,
MODIFIABLE_SCHEMA_KEYS_PER_TYPE):
continue
# If a key was removed in the new schema, check if the removal was
# allowed. If not this is an error. The removal of some schema keys make
# the schema less restrictive (e.g. removing 'required' keys in
# dictionaries or removing 'minimum' in integer schemas).
if old_key not in new_schema:
if not IsKeyDefinedForTypeInDictionary(
schema_type, old_key, REMOVABLE_SCHEMA_VALUES_PER_TYPE):
self._Error(
'Key \'%s\' in old policy schema path \'%s\' was removed in '
'newer version.' % (old_key, current_schema_key))
continue
# For a given type that has a key that can define dictionaries of schemas
# (e.g. 'object' types), we need to validate the schema of each individual
# property that is defined. We also need to validate that no old
# properties were removed. Any new properties can be added.
if IsKeyDefinedForTypeInDictionary(
schema_type, old_key, KEYS_DEFINING_PROPERTY_DICT_SCHEMAS_PER_TYPE):
if type(old_value) is not dict:
self._Error(
'Unexpected type \'%s\' at policy schema path \'%s\'. It must be '
'dict' % (type(old_value).__name__,))
continue
# Make all old properties exist and are compatible. Everything else that
# is new requires no validation.
new_schema_value = new_schema[old_key]
for sub_key in old_value.keys():
self._CheckSchemasAreCompatible(
schema_key_path + [old_key, sub_key], old_value[sub_key],
new_schema_value[sub_key]
if sub_key in new_schema_value else None)
# For types that have a key that themselves define a schema (e.g. 'items'
# schema in an 'array' type), we need to validate the schema defined in
# the key.
elif IsKeyDefinedForTypeInDictionary(schema_type, old_key,
KEYS_DEFINING_SCHEMAS_PER_TYPE):
self._CheckSchemasAreCompatible(
schema_key_path + [old_key], old_value,
new_schema[old_key] if old_key in new_schema else None)
# For any other key, we just check if the two values of the key are
# compatible with each other, possibly allowing removal of entries in
# array values if needed (e.g. removing 'required' fields makes the schema
# less restrictive).
else:
self._CheckSchemaValueIsCompatible(
schema_key_path + [old_key], old_value, new_schema[old_key],
IsKeyDefinedForTypeInDictionary(schema_type, old_key,
REMOVABLE_SCHEMA_VALUES_PER_TYPE),
CUSTOM_VALUE_CHANGE_VALIDATION_PER_TYPE[schema_type][old_key]
if IsKeyDefinedForTypeInDictionary(
schema_type, old_key,
CUSTOM_VALUE_CHANGE_VALIDATION_PER_TYPE) else None)
for new_key in (old_key for old_key in new_schema.keys()
if not old_key in old_schema.keys()):
self._Error(
'Key \'%s\' was added to policy schema path \'%s\' in new schema.' %
(new_key, current_schema_key))
def _CheckPolicyDefinitionChangeCompatibility(self, original_policy,
new_policy, current_version):
'''
Checks if the new policy definition is compatible with the original policy
definition.
|original_policy|: The policy definition as it was in the original policy
templates file.
|new_policy|: The policy definition as it is (if any) in the modified policy
templates file.
|current_version|: The current major version of the branch as stored in
chrome/VERSION.
'''
# 1. Check if the supported_on versions are valid.
# All starting versions in supported_on in the original policy must also
# appear in the changed policy. The only thing that can be added is an
# ending version.
new_supported_versions = {}
for new_supported_version in new_policy['supported_on']:
(supported_on_platform, supported_on_from_version,
_) = self._GetSupportedVersionPlatformAndRange(new_supported_version)
new_supported_versions[supported_on_platform] = supported_on_from_version
is_pushed_postponed = False
has_version_error = False
for original_supported_on in original_policy['supported_on']:
(original_supported_on_platform, original_supported_on_version,
_) = self._GetSupportedVersionPlatformAndRange(original_supported_on)
if original_supported_on_platform not in new_supported_versions:
self._Error(
'Cannot remove supported_on \'%s\' on released policy \'%s\'.' %
(original_supported_on_platform, original_policy['name']))
has_version_error = True
# It's possible that a policy was cut to the stable branch but now we
# want to release later than the current stable breanch. We check if
# we are trying to change the supported version of the policy to
# version_of_stable_branch + 1.
# This means:
# original supported version ==
# version of stable branch == current_version - 1
# and
# changed supported version = current dev version = current_version.
elif new_supported_versions[
original_supported_on_platform] != original_supported_on_version:
if (not new_supported_versions[original_supported_on_platform] >=
original_supported_on_version or
original_supported_on_version != current_version - 1):
has_version_error = True
self._Error(
'Cannot change the supported_on of released policy \'%s\' on '
'platform \'%s\' from %d to %d.' %
(original_policy['name'], original_supported_on_platform,
original_supported_on_version,
new_supported_versions[original_supported_on_platform]))
elif (original_supported_on_version == current_version - 1):
is_pushed_postponed = True
# If the policy release has been pushed back from the stable branch we
# consider the policy as un-released and all changes to it are allowed.
if is_pushed_postponed and not has_version_error:
print('Policy %s release has been postponed. Skipping further '
'verification') % (
new_policy['name'])
return
#3. Check if the type of the policy has changed.
if new_policy['type'] != original_policy['type']:
self._Error(
'Cannot change the type of released policy \'%s\' from %s to %s.' %
(new_policy['name'], original_policy['type'], new_policy['type']))
#4 Check if the policy has suddenly been marked as future: true.
if ('future' in new_policy and
new_policy['future']) and ('future' not in original_policy or
not original_policy['future']):
self._Error('Cannot make released policy \'%s\' a future policy' %
(new_policy['name']))
original_device_only = ('device_only' in original_policy and
original_policy['device_only'])
#5 Check if the policy has changed its device_only value
if (('device_only' in new_policy and
original_device_only != new_policy['device_only']) or
('device_only' not in new_policy and original_device_only)):
self._Error(
'Cannot change the device_only status of released policy \'%s\'' %
(new_policy['name']))
#6 Check schema changes for compatibility.
self._CheckSchemasAreCompatible([original_policy['name']],
original_policy['schema'],
new_policy['schema'])
# Checks if the new policy definitions are compatible with the policy
# definitions coming from the original_file_contents.
def _CheckPolicyDefinitionsChangeCompatibility(
self, policy_definitions, original_file_contents, current_version):
'''
Checks if all the |policy_definitions| in the modified policy templates file
are compatible with the policy definitions defined in the original policy
templates file with |original_file_contents| .
|policy_definitions|: The policy definition as it is in the modified policy
templates file.
|original_file_contents|: The full contents of the original policy templates
file.
|current_version|: The current major version of the branch as stored in
chrome/VERSION.
'''
try:
original_container = eval(original_file_contents)
except:
import traceback
traceback.print_exc(file=sys.stdout)
self._Error('Invalid Python/JSON syntax in original file.')
return
if original_container == None:
self._Error('Invalid Python/JSON syntax in original file.')
return
original_policy_definitions = self._CheckContains(
original_container,
'policy_definitions',
list,
parent_element=None,
optional=True,
container_name='The root element',
offending=None)
if original_policy_definitions is None:
return
# Sort the new policies by name for faster searches.
policy_definitions_dict = {
policy['name']: policy
for policy in policy_definitions
if policy['type'] != 'group'
}
for original_policy in original_policy_definitions:
# Check change compatibility for all non-group policy definitions.
if original_policy['type'] == 'group':
continue
# First check if the unchanged policy is considered unreleased. If it is
# then any change on it is allowed and we can skip verification.
if not self._CheckPolicyIsReleasedToStableBranch(original_policy,
current_version):
continue
# The unchanged policy is considered released, now check if the changed
# policy is still present and has the valid supported_on versions.
new_policy = policy_definitions_dict.get(original_policy['name'])
# A policy that is considered released cannot be removed.
if new_policy is None:
self._Error('Released policy \'%s\' has been removed.' %
original_policy['name'])
continue
self._CheckPolicyDefinitionChangeCompatibility(
original_policy, new_policy, current_version)
def _LeadingWhitespace(self, line):
match = LEADING_WHITESPACE.match(line)
if match:
......@@ -1291,7 +754,7 @@ class PolicyTemplateChecker(object):
self._Error('Missing atomic group id %s' % (i + 1))
return
def Main(self, filename, options, original_file_contents, current_version):
def Main(self, filename, options):
try:
with open(filename, "rb") as f:
data = eval(f.read().decode("UTF-8"))
......@@ -1428,28 +891,7 @@ class PolicyTemplateChecker(object):
# Second part: check formatting.
self._CheckFormat(filename)
# Third part: if the original file contents are available, try to check
# if the new policy definitions are compatible with the original policy
# definitions (if the original file contents have not raised any syntax
# errors).
current_error_count = self.error_count
if (not current_error_count and original_file_contents is not None and
current_version is not None):
self._CheckPolicyDefinitionsChangeCompatibility(
policy_definitions, original_file_contents, current_version)
if current_error_count != self.error_count:
print(
'There were compatibility validation errors in the change. You may '
'bypass this validation by adding "BYPASS_POLICY_COMPATIBILITY_CHECK='
'<justification>" to your changelist description. If you believe '
'that this validation is a bug, please file a crbug against '
'"Enterprise>CloudPolicy" and add a link to the bug as '
'justification. Otherwise, please provide an explanation for the '
'change. For more information please refer to: '
'https://bit.ly/33qr3ZV.')
# Fourth part: summary and exit.
# Third part: summary and exit.
print('Finished checking %s. %d errors, %d warnings.' %
(filename, self.error_count, self.warning_count))
if self.options.stats:
......@@ -1464,11 +906,7 @@ class PolicyTemplateChecker(object):
return 1
return 0
def Run(self,
argv,
filename=None,
original_file_contents=None,
current_version=None):
def Run(self, argv, filename=None):
parser = optparse.OptionParser(
usage='usage: %prog [options] filename',
description='Syntax check a policy_templates.json file.')
......@@ -1493,7 +931,7 @@ class PolicyTemplateChecker(object):
if options.device_policy_proto_path is None:
print('Error: Missing --device_policy_proto_path argument.')
return 1
return self.Main(filename, options, original_file_contents, current_version)
return self.Main(filename, options)
if __name__ == '__main__':
......
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