← Back to team overview

cloud-init-dev team mailing list archive

[Merge] lp:~harlowja/cloud-init/yaml-checking into lp:cloud-init

 

Joshua Harlow has proposed merging lp:~harlowja/cloud-init/yaml-checking into lp:cloud-init.

Requested reviews:
  cloud init development team (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~harlowja/cloud-init/yaml-checking/+merge/133403
-- 
https://code.launchpad.net/~harlowja/cloud-init/yaml-checking/+merge/133403
Your team cloud init development team is requested to review the proposed merge of lp:~harlowja/cloud-init/yaml-checking into lp:cloud-init.
=== modified file 'Makefile'
--- Makefile	2012-11-07 15:35:39 +0000
+++ Makefile	2012-11-08 05:02:20 +0000
@@ -2,6 +2,10 @@
 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 @@
 	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
 

=== modified file 'doc/examples/cloud-config.txt'
--- doc/examples/cloud-config.txt	2012-11-07 15:29:20 +0000
+++ doc/examples/cloud-config.txt	2012-11-08 05:02:20 +0000
@@ -355,8 +355,7 @@
  - ':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

=== modified file 'tests/configs/sample1.yaml'
--- tests/configs/sample1.yaml	2012-07-03 01:43:54 +0000
+++ tests/configs/sample1.yaml	2012-11-08 05:02:20 +0000
@@ -50,4 +50,3 @@
  
 
 byobu_by_default: user
-output: {all: '| tee -a /var/log/cloud-init-output.log'}

=== added file 'tools/validate-yaml.py'
--- tools/validate-yaml.py	1970-01-01 00:00:00 +0000
+++ tools/validate-yaml.py	2012-11-08 05:02:20 +0000
@@ -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))


Follow ups