summaryrefslogtreecommitdiff
path: root/tools/validate-yaml.py
blob: d3218e4090180efc41f6ff2dcbc110c93208a678 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env python

"""Try to read a YAML file and report any errors.
"""

import sys

import yaml


if __name__ == "__main__":
    for fn in sys.argv[1:]:
        sys.stdout.write("%s" % (fn))
        try:
            fh = open(fn, 'r')
            yaml.safe_load(fh.read())
            fh.close()
            sys.stdout.write(" - ok\n")
        except Exception, e:
            sys.stdout.write(" - bad (%s)\n" % (e))