42c2419353
Change-Id: Ie6e77a4d45210122746b544a1aa8da563833e395 Partially-Implements: blueprint enable-flake8
33 lines
620 B
Python
Executable File
33 lines
620 B
Python
Executable File
#!/usr/bin/python
|
|
|
|
import sys
|
|
import argparse
|
|
import yaml
|
|
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:
|
|
yaml.load(fd)
|
|
except yaml.error.YAMLError as error:
|
|
res = 1
|
|
logging.error('%s failed validation: %s',
|
|
filename, error)
|
|
|
|
sys.exit(res)
|
|
|
|
if __name__ == '__main__':
|
|
main()
|