Merge the yaml/cloud config examples checking tool.
This commit is contained in:
commit
ce2d9209bd
9
Makefile
9
Makefile
@ -2,6 +2,10 @@ CWD=$(shell pwd)
|
||||
PY_FILES=$(shell find cloudinit bin tests tools -name "*.py" -type f )
|
||||
PY_FILES+="bin/cloud-init"
|
||||
|
||||
YAML_FILES=$(shell find cloudinit bin tests tools -name "*.yaml" -type f )
|
||||
YAML_FILES+=$(shell find doc/examples -name "cloud-config*.txt" -type f )
|
||||
|
||||
|
||||
all: test
|
||||
|
||||
pep8:
|
||||
@ -23,11 +27,14 @@ clean:
|
||||
rm -rf /var/log/cloud-init.log \
|
||||
/var/lib/cloud/
|
||||
|
||||
yaml:
|
||||
@$(CWD)/tools/validate-yaml.py $(YAML_FILES)
|
||||
|
||||
rpm:
|
||||
./packages/brpm
|
||||
|
||||
deb:
|
||||
./packages/bddeb
|
||||
|
||||
.PHONY: test pylint pyflakes 2to3 clean pep8 rpm deb
|
||||
.PHONY: test pylint pyflakes 2to3 clean pep8 rpm deb yaml
|
||||
|
||||
|
@ -355,8 +355,7 @@ rsyslog:
|
||||
- ':syslogtag, isequal, "[CLOUDINIT]" /var/log/cloud-foo.log'
|
||||
- content: "*.* @@192.0.2.1:10514"
|
||||
- filename: 01-examplecom.conf
|
||||
content: |
|
||||
*.* @@syslogd.example.com
|
||||
content: "*.* @@syslogd.example.com"
|
||||
|
||||
# resize_rootfs should the / filesytem be resized on first boot
|
||||
# this allows you to launch an instance with a larger disk / partition
|
||||
|
@ -50,4 +50,3 @@ runcmd:
|
||||
|
||||
|
||||
byobu_by_default: user
|
||||
output: {all: '| tee -a /var/log/cloud-init-output.log'}
|
||||
|
26
tools/validate-yaml.py
Executable file
26
tools/validate-yaml.py
Executable file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""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, 'r')
|
||||
yaml.safe_load(fh.read())
|
||||
fh.close()
|
||||
sys.stdout.write(" - ok\n")
|
||||
except Exception, e:
|
||||
sys.stdout.write(" - bad (%s)\n" % (e))
|
||||
bads += 1
|
||||
if bads > 0:
|
||||
sys.exit(1)
|
||||
else:
|
||||
sys.exit(0)
|
Loading…
x
Reference in New Issue
Block a user