From cd001799763a40ffb8fe996933282d9837242fc2 Mon Sep 17 00:00:00 2001 From: K Jonathan Harker Date: Thu, 28 May 2015 14:21:51 -0700 Subject: [PATCH] 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 --- tools/apply-test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/apply-test.sh b/tools/apply-test.sh index a946dad82c..9ee1c5bc3b 100755 --- a/tools/apply-test.sh +++ b/tools/apply-test.sh @@ -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