summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Putnam <putnam.eric@gmail.com>2016-10-04 06:38:35 -0700
committerGitHub <noreply@github.com>2016-10-04 06:38:35 -0700
commitc046716de30c55662cff0d11efa573f0d572d984 (patch)
tree920fd0087601c2ca17737cedaa85cfc7ad597c6d
parent6ebb58623c49f738e2fe857974d54eb5c8638cea (diff)
parent3c12e20526b4c6c6e36f6acc103f42f7e5915477 (diff)
Merge pull request #663 from DavidS/modules-3933-getparam-false-values
(MODULES-3933) Fix getparam for 'false' values
-rw-r--r--lib/puppet/parser/functions/getparam.rb2
-rwxr-xr-xspec/functions/getparam_spec.rb5
2 files changed, 2 insertions, 5 deletions
diff --git a/lib/puppet/parser/functions/getparam.rb b/lib/puppet/parser/functions/getparam.rb
index 6d51006..0a5cbe0 100644
--- a/lib/puppet/parser/functions/getparam.rb
+++ b/lib/puppet/parser/functions/getparam.rb
@@ -28,7 +28,7 @@ ENDOFDOC
return '' if param.empty?
if resource = findresource(reference.to_s)
- return resource[param] if resource[param]
+ return resource[param] unless resource[param].nil?
end
return ''
diff --git a/spec/functions/getparam_spec.rb b/spec/functions/getparam_spec.rb
index 9e3d9e4..e4ef9e6 100755
--- a/spec/functions/getparam_spec.rb
+++ b/spec/functions/getparam_spec.rb
@@ -22,9 +22,6 @@ describe 'getparam' do
it { is_expected.to run.with_params('User[one]', 'ensure').and_return('present') }
it { is_expected.to run.with_params('User[two]', 'ensure').and_return('') }
it { is_expected.to run.with_params('User[one]', 'shell').and_return('/bin/sh') }
- it {
- pending("both rspec-puppet as well as the function do the wrong thing here.")
- is_expected.to run.with_params('User[one]', 'managehome').and_return(false)
- }
+ it { is_expected.to run.with_params('User[one]', 'managehome').and_return(false) }
end
end