yaml-validator - network_data validate show all errors

Instead of exiting on the first error, set the return
value to 1 whenever an error is found and continue
validating the file. By doing this all errors are made
visible with a single run.

Change-Id: I0ecccf3113eeb511b77c447edce0c317f7642f80
This commit is contained in:
Harald Jensås 2018-07-04 23:45:50 +02:00
parent 56dd8bd8a5
commit b9f185c607
1 changed files with 3 additions and 1 deletions

View File

@ -1162,12 +1162,14 @@ def validate_network_data_file(data_file_path):
data_file = yaml.load(open(data_file_path).read())
base_file_path = os.path.dirname(data_file_path) + "/network_data.yaml"
base_file = yaml.load(open(base_file_path).read())
retval = 0
for n in base_file:
if n not in data_file:
print('ERROR: The following network from network_data.yaml is '
'missing or differs in %s : %s'
% (data_file_path, n))
return 1
retval = 1
return retval
except Exception:
print(traceback.format_exc())
return 1