Skip to content

Commit

Permalink
Change module feature default to capitalize
Browse files Browse the repository at this point in the history
foreman_proxy::plugin::module uses $title.capitalize() and now
foreman_proxy::module does too. This makes it more consistent. It also
explicitly sets the feature where needed. This was explained in an
issue[1].

[1]: theforeman#773 (comment)
  • Loading branch information
ekohl committed Oct 31, 2022
1 parent 5141989 commit 89d5acf
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion manifests/module.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
Boolean $enabled = false,
Foreman_proxy::ListenOn $listen_on = 'https',
Optional[String] $template_path = undef,
String $feature = upcase($title),
String $feature = $title.capitalize(),
) {
if $enabled {
$module_enabled = $listen_on ? {
Expand Down
1 change: 1 addition & 0 deletions manifests/module/bmc.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
) {
foreman_proxy::module { 'bmc':
enabled => $enabled,
feature => 'BMC',
listen_on => $listen_on,
}
}
1 change: 1 addition & 0 deletions manifests/module/dhcp.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
) {
foreman_proxy::module { 'dhcp':
enabled => $enabled,
feature => 'DHCP',
listen_on => $listen_on,
}
}
1 change: 1 addition & 0 deletions manifests/module/dns.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
) {
foreman_proxy::module { 'dns':
enabled => $enabled,
feature => 'DNS',
listen_on => $listen_on,
}
}
1 change: 1 addition & 0 deletions manifests/module/tftp.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

foreman_proxy::module { 'tftp':
enabled => $enabled,
feature => 'TFTP',
listen_on => $listen_on,
}
}
10 changes: 5 additions & 5 deletions spec/defines/foreman_proxy_module_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
context 'with defaults' do
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_foreman_proxy__settings_file('test').with_module_enabled('false') }
it { is_expected.not_to contain_foreman_proxy__feature('TEST') }
it { is_expected.not_to contain_foreman_proxy__feature('Test') }
end

context 'with enabled => true' do
let(:params) { { enabled: true } }

it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_foreman_proxy__settings_file('test').with_module_enabled('https') }
it { is_expected.to contain_foreman_proxy__feature('TEST') }
it { is_expected.to contain_foreman_proxy__feature('Test') }

context 'with listen_on => both' do
let(:params) { super().merge(listen_on: 'both') }
Expand All @@ -36,16 +36,16 @@
end

context 'with feature' do
let(:params) { { feature: 'Test' } }
let(:params) { { feature: 'TEST' } }

it { is_expected.to compile.with_all_deps }
it { is_expected.not_to contain_foreman_proxy__feature('Test') }
it { is_expected.not_to contain_foreman_proxy__feature('TEST') }

context 'with enabled => true' do
let(:params) { super().merge(enabled: true) }

it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_foreman_proxy__feature('Test') }
it { is_expected.to contain_foreman_proxy__feature('TEST') }
end
end
end
Expand Down

0 comments on commit 89d5acf

Please sign in to comment.