overcloud.yaml: overcloud-source.yaml nova-compute-instance.yaml
python merge.py $< > $@.tmp
mv $@.tmp $@
+
+test:
+ @bash test_merge.bash
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'.
--- /dev/null
+Parameters:
+ ImportantValue:
+ Default: a_default
+ Type: String
+Resources:
+ GenericB:
+ Type: OS::Nova::Server
+ Properties:
+ image: {Ref: BImage}
+ Metadata:
+ my_meta: {Ref: ImportantValue}
--- /dev/null
+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']]}
--- /dev/null
+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
--- /dev/null
+#!/bin/bash
+set -ue
+result=""
+cleanup() {
+ if [ -n "$result" ] ; then
+ rm -f $result
+ fi
+}
+trap cleanup EXIT
+result=$(mktemp /tmp/test_merge.XXXXXX)
+fail=0
+python merge.py examples/source.yaml > $result
+if ! cmp $result examples/source_lib_result.yaml ; then
+ diff -u $result examples/source_lib_result.yaml
+ echo
+ echo FAIL - merge of source.yaml result does not match expected output
+ echo
+ fail=1
+else
+ echo
+ echo PASS - merge of source.yaml result matches expected output
+ echo
+fi
+exit $fail