42c2419353
Change-Id: Ie6e77a4d45210122746b544a1aa8da563833e395 Partially-Implements: blueprint enable-flake8
33 lines
610 B
Python
Executable File
33 lines
610 B
Python
Executable File
#!/usr/bin/python
|
|
|
|
import sys
|
|
import argparse
|
|
import json
|
|
import logging
|
|
|
|
|
|
def parse_args():
|
|
p = argparse.ArgumentParser()
|
|
p.add_argument('input', nargs='*')
|
|
return p.parse_args()
|
|
|
|
|
|
def main():
|
|
args = parse_args()
|
|
logging.basicConfig()
|
|
res = 0
|
|
|
|
for filename in args.input:
|
|
with open(filename) as fd:
|
|
try:
|
|
json.load(fd)
|
|
except ValueError as error:
|
|
res = 1
|
|
logging.error('%s failed validation: %s',
|
|
filename, error)
|
|
|
|
sys.exit(res)
|
|
|
|
if __name__ == '__main__':
|
|
main()
|