diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | README.md | 8 | ||||
-rw-r--r-- | examples/lib.yaml | 13 | ||||
-rw-r--r-- | examples/source.yaml | 15 | ||||
-rw-r--r-- | examples/source_lib_result.yaml | 24 | ||||
-rw-r--r-- | nova-compute-instance.yaml | 2 | ||||
-rw-r--r-- | test_merge.bash | 29 |
8 files changed, 95 insertions, 1 deletions
@@ -39,3 +39,5 @@ nosetests.xml *~ *.swp + +doc/_build @@ -6,3 +6,6 @@ notcompute.yaml: $(NOTCOMPUTE) overcloud.yaml: overcloud-source.yaml nova-compute-instance.yaml python merge.py $< > $@.tmp mv $@.tmp $@ + +test: + @bash test_merge.bash @@ -1,4 +1,10 @@ templates ========= -Generic templates to describe multi-host infrastructure, consumable by OpenStack Heat, Crowbar, others.
\ No newline at end of file +Generic templates to describe multi-host infrastructure, consumable by OpenStack Heat, Crowbar, others. + + +merge.py +======== + +The Makefile contains several targets for generated templates, see its contents for all of them. To run functional tests for merge.py, run 'make test'. diff --git a/examples/lib.yaml b/examples/lib.yaml new file mode 100644 index 00000000..d42e95f8 --- /dev/null +++ b/examples/lib.yaml @@ -0,0 +1,13 @@ +Parameters: + ImportantValue: + Default: a_default + Type: String + BImage: + Type: String +Resources: + GenericB: + Type: OS::Nova::Server + Properties: + image: {Ref: BImage} + Metadata: + my_meta: {Ref: ImportantValue} diff --git a/examples/source.yaml b/examples/source.yaml new file mode 100644 index 00000000..89707a7b --- /dev/null +++ b/examples/source.yaml @@ -0,0 +1,15 @@ +Parameters: + SourceImage: + Type: String + Default: my_image +Resources: + A: + Type: OS::Nova::Server + Properties: + image: {Ref: SourceImage} + B: + Type: FileInclude + Path: examples/lib.yaml + SubKey: Resources.GenericB + Parameters: + ImportantValue: {'Fn::Join': [ '', ['one', 'two', 'three']]} diff --git a/examples/source_lib_result.yaml b/examples/source_lib_result.yaml new file mode 100644 index 00000000..a165cabf --- /dev/null +++ b/examples/source_lib_result.yaml @@ -0,0 +1,24 @@ +Description: examples/source.yaml +HeatTemplateFormatVersion: '2012-12-12' +Parameters: + AImage: null + Default: my_image + Type: String +Resources: + A: + Properties: + image: + Ref: AImage + Type: OS::Nova::Server + B: + Metadata: + my_meta: + Fn::Join: + - '' + - - one + - two + - three + Properties: + image: + Ref: BImage + Type: OS::Nova::Server diff --git a/nova-compute-instance.yaml b/nova-compute-instance.yaml index f027f3b5..3074228e 100644 --- a/nova-compute-instance.yaml +++ b/nova-compute-instance.yaml @@ -128,6 +128,8 @@ Resources: network_vlan_ranges: {Ref: NeutronNetworkVLANRanges} bridge_mappings: {Ref: NeutronBridgeMappings} enable_tunneling: {Ref: NeutronEnableTunnelling} + service-password: + Ref: NeutronPassword admin-password: {Ref: AdminPassword} rabbit: host: {Ref: RabbitHost} diff --git a/test_merge.bash b/test_merge.bash new file mode 100644 index 00000000..004a613e --- /dev/null +++ b/test_merge.bash @@ -0,0 +1,29 @@ +#!/bin/bash +set -ue +result="" +cleanup() { + if [ -n "$result" ] ; then + rm -f $result + fi +} +trap cleanup EXIT +run_test() { + local cmd=$1 + local expected=$2 + result=$(mktemp /tmp/test_merge.XXXXXX) + fail=0 + $cmd > $result + if ! cmp $result $expected ; then + diff -u $expected $result || : + echo FAIL - $cmd result does not match expected + fail=1 + else + echo PASS - $cmd + fi + cleanup +} +echo +run_test "python merge.py examples/source.yaml" examples/source_lib_result.yaml +echo +trap - EXIT +exit $fail |