Allow blank lines in node{} with apply test
The apply test does some really simple string manipulation to generate puppet manifests based on our site.pp on the fly. Unfortunately the old code assumed there would be no blank lines within a node{} definition. This assumption is breaking as we work to decouple the openstack_project::server contents from within openstack_project manifests and move that into site.pp. This is a relatively simple fix where we csplit nodes based on the previous /^}$/ which ends the last node{} definition instead of splitting on blank lines. Added some comments to make what the parsing does a bit more clear. Change-Id: I2cc7317ed90423d6f923c4303a76e091a0bc2ebb
This commit is contained in:
parent
59be4d7a52
commit
797feda87a
@ -59,10 +59,17 @@ if [[ ! -d applytest ]] ; then
|
|||||||
mkdir applytest
|
mkdir applytest
|
||||||
fi
|
fi
|
||||||
|
|
||||||
csplit -sf applytest/puppetapplytest manifests/site.pp '/^$/' {*}
|
# First split the variables at the beginning of the file
|
||||||
sed -i -e 's/^[^][:space:]$]/#&/g' applytest/puppetapplytest*
|
csplit -sf applytest/prep manifests/site.pp '/^$/' {0}
|
||||||
sed -i -e 's@hiera(.\([^.]*\).,\([^)]*\))@\2@' applytest/puppetapplytest*
|
# Then split the class defs.
|
||||||
mv applytest/*00 applytest/head # These are the top-level variables defined in site.pp
|
csplit -sf applytest/puppetapplytest applytest/prep01 '/^}$/' {*}
|
||||||
|
# Remove } header left by csplit
|
||||||
|
sed -i -e '/^\}$/d' applytest/puppetapplytest*
|
||||||
|
# Comment out anything that doesn't begin with a space.
|
||||||
|
# This gives us the node {} internal contents.
|
||||||
|
sed -i -e 's/^[^][:space:]$]/#&/g' applytest/prep00 applytest/puppetapplytest*
|
||||||
|
sed -i -e 's@hiera(.\([^.]*\).,\([^)]*\))@\2@' applytest/prep00 applytest/puppetapplytest*
|
||||||
|
mv applytest/prep00 applytest/head # These are the top-level variables defined in site.pp
|
||||||
|
|
||||||
if [[ `lsb_release -i -s` == 'CentOS' ]]; then
|
if [[ `lsb_release -i -s` == 'CentOS' ]]; then
|
||||||
if [[ `lsb_release -r -s` =~ '6' ]]; then
|
if [[ `lsb_release -r -s` =~ '6' ]]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user