~smoser/cloud-init/lp-1077700

« back to all changes in this revision

Viewing changes to tools/validate-yaml.py

  • Committer: Joshua Harlow
  • Date: 2012-11-08 16:55:04 UTC
  • mto: This revision was merged to the branch mainline in revision 706.
  • Revision ID: harlowja@gmail.com-20121108165504-sfw4zy7zcz50ki1x
Add non-zero exit code when
bad yamls are found instead
of returning zero in that case.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
 
10
10
 
11
11
if __name__ == "__main__":
 
12
    bads = 0
12
13
    for fn in sys.argv[1:]:
13
14
        sys.stdout.write("%s" % (fn))
14
15
        try:
18
19
            sys.stdout.write(" - ok\n")
19
20
        except Exception, e:
20
21
            sys.stdout.write(" - bad (%s)\n" % (e))
 
22
            bads += 1
 
23
    if bads > 0:
 
24
        sys.exit(1)
 
25
    else:
 
26
        sys.exit(0)