Make hiera default values optional

Currently, all hiera calls need to have default values in order for the
apply test to work. This is done by using sed to replace the hiera call
with the default value in the call, i.e. 'hiera("foo", "bar")' is
replaced with '"bar"'.

This adds another sed command that replaces a hiera call that has no
default value specified with the name of the key appended with
NoDefault, i.e. 'hiera("foo")' will become '"fooNoDefault"'.

By making the hiera default values optional, we no longer need to pass
in a default value to every hiera call, and so we can remove the
placeholder XXX that were previously needed by the apply tests but not
by puppet itself.

Change-Id: Ibdeb0c2e49245ea05116e8043936d5b012f46666
This commit is contained in:
K Jonathan Harker 2015-05-28 14:21:51 -07:00
parent 0e9a8b4161
commit cd00179976

View File

@ -76,6 +76,7 @@ sed -i -e '/^\}$/d' applytest/puppetapplytest*
# 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*
sed -i -e "s@hiera(.\([^.]*\).)@'\1NoDefault'@" 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