-
Notifications
You must be signed in to change notification settings - Fork 614
Fix postgresql::default()
return value for unknown parameters
#1530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,7 @@ function postgresql::default( | |
) { | ||
include postgresql::params | ||
|
||
#search for the variable name in params first | ||
#then fall back to globals if not found | ||
pick( getvar("postgresql::params::${parameter_name}"), | ||
"postgresql::globals::${parameter_name}") | ||
# Search for the variable name in params. | ||
# params inherits from globals, so it will also catch these variables. | ||
pick(getvar("postgresql::params::${parameter_name}")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Late to the party, but what's the point of using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suspected that, but good to hear that explicitly. |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
describe 'postgresql::default' do | ||
let(:facts) do | ||
{ | ||
'os' => { | ||
'family' => 'Debian', | ||
'name' => 'Debian', | ||
'release' => { | ||
'full' => '11.7', | ||
'major' => '11', | ||
'minor' => '7', | ||
} | ||
} | ||
} | ||
end | ||
|
||
let(:pre_condition) do | ||
<<~PP | ||
class { 'postgresql::server': | ||
} | ||
PP | ||
end | ||
|
||
# parameter in params.pp only | ||
it { is_expected.to run.with_params('port').and_return(5432) } | ||
|
||
# parameter in globals.pp only | ||
it { is_expected.to run.with_params('default_connect_settings').and_return({}) } | ||
|
||
it { is_expected.to run.with_params('a_parameter_that_does_not_exist').and_raise_error(Puppet::ParseError, %r{pick\(\): must receive at least one non empty value}) } | ||
end |
Uh oh!
There was an error while loading. Please reload this page.