|
Server : Apache System : Linux server.mata-lashes.com 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64 User : matalashes ( 1004) PHP Version : 8.1.29 Disable Function : NONE Directory : /usr/src/cloud-init/tools/ |
Upload File : |
#!/usr/bin/env python3
"""Try to read a YAML file and report any errors.
"""
import sys
import yaml
if __name__ == "__main__":
bads = 0
for fn in sys.argv[1:]:
sys.stdout.write("%s" % (fn))
try:
fh = open(fn, "rb")
yaml.safe_load(fh.read().decode("utf-8"))
fh.close()
sys.stdout.write(" - ok\n")
except Exception as e:
sys.stdout.write(" - bad (%s)\n" % (e))
bads += 1
if bads > 0:
sys.exit(1)
else:
sys.exit(0)
# vi: ts=4 expandtab