Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions lib/puppet/parser/functions/pick.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,9 @@ module Puppet::Parser::Functions
called 'jenkins_version' (note that parameters set in the Puppet Dashboard/
Enterprise Console are brought into Puppet as top-scope variables), and,
failing that, will use a default value of 1.449.

If you have `strict_variables` turned on, then wrap your variable in single
quotes to prevent interpolation and this function will check to see if that
variable exists.

$real_jenkins_version = pick('$::jenkins_version', '1.449')

DOC
) do |args|
# look up the values of any strings that look like '$variables' w/o mutating args
args = args.map do |item|
next item unless item.is_a? String
item.start_with?('$') ? call_function('getvar', [item.slice(1..-1)]) : item
end
args.compact!
args = args.compact
args.delete(:undef)
args.delete(:undefined)
args.delete('')
Expand Down
3 changes: 0 additions & 3 deletions spec/functions/pick_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
it { is_expected.to run.with_params(:undef, 'two').and_return('two') }
it { is_expected.to run.with_params(:undefined, 'two').and_return('two') }
it { is_expected.to run.with_params(nil, 'two').and_return('two') }
it { is_expected.to run.with_params('$foo', 'two').and_return('two') }
it { is_expected.to run.with_params('$puppetversion', 'two').and_return(Puppet.version) }
it { is_expected.to run.with_params('$::puppetversion', 'two').and_return(Puppet.version) }

context 'with UTF8 and double byte characters' do
it { is_expected.to run.with_params(nil, 'このテキスト').and_return('このテキスト') }
Expand Down