summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile9
-rw-r--r--doc/examples/cloud-config.txt3
-rw-r--r--tests/configs/sample1.yaml1
-rwxr-xr-xtools/validate-yaml.py20
4 files changed, 29 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 88c90b9b..2a6be961 100644
--- a/Makefile
+++ b/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
diff --git a/doc/examples/cloud-config.txt b/doc/examples/cloud-config.txt
index 04bb5df1..12bf2c91 100644
--- a/doc/examples/cloud-config.txt
+++ b/doc/examples/cloud-config.txt
@@ -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
diff --git a/tests/configs/sample1.yaml b/tests/configs/sample1.yaml
index 24e874ee..6231f293 100644
--- a/tests/configs/sample1.yaml
+++ b/tests/configs/sample1.yaml
@@ -50,4 +50,3 @@ runcmd:
byobu_by_default: user
-output: {all: '| tee -a /var/log/cloud-init-output.log'}
diff --git a/tools/validate-yaml.py b/tools/validate-yaml.py
new file mode 100755
index 00000000..d3218e40
--- /dev/null
+++ b/tools/validate-yaml.py
@@ -0,0 +1,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))