From 89d5acf9b545eebe455a38fa77a129e4088017e4 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Fri, 28 Oct 2022 15:13:52 +0200 Subject: [PATCH] Change module feature default to capitalize 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]: https://github.com/theforeman/puppet-foreman_proxy/pull/773#issuecomment-1206289813 --- manifests/module.pp | 2 +- manifests/module/bmc.pp | 1 + manifests/module/dhcp.pp | 1 + manifests/module/dns.pp | 1 + manifests/module/tftp.pp | 1 + spec/defines/foreman_proxy_module_spec.rb | 10 +++++----- 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/manifests/module.pp b/manifests/module.pp index ae0de1e4..ac63b504 100644 --- a/manifests/module.pp +++ b/manifests/module.pp @@ -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 ? { diff --git a/manifests/module/bmc.pp b/manifests/module/bmc.pp index 15ad3a22..1d117bc7 100644 --- a/manifests/module/bmc.pp +++ b/manifests/module/bmc.pp @@ -11,6 +11,7 @@ ) { foreman_proxy::module { 'bmc': enabled => $enabled, + feature => 'BMC', listen_on => $listen_on, } } diff --git a/manifests/module/dhcp.pp b/manifests/module/dhcp.pp index 52d4b18c..defa2374 100644 --- a/manifests/module/dhcp.pp +++ b/manifests/module/dhcp.pp @@ -11,6 +11,7 @@ ) { foreman_proxy::module { 'dhcp': enabled => $enabled, + feature => 'DHCP', listen_on => $listen_on, } } diff --git a/manifests/module/dns.pp b/manifests/module/dns.pp index 0db142ef..e1f91493 100644 --- a/manifests/module/dns.pp +++ b/manifests/module/dns.pp @@ -11,6 +11,7 @@ ) { foreman_proxy::module { 'dns': enabled => $enabled, + feature => 'DNS', listen_on => $listen_on, } } diff --git a/manifests/module/tftp.pp b/manifests/module/tftp.pp index e5b26860..dfaccf91 100644 --- a/manifests/module/tftp.pp +++ b/manifests/module/tftp.pp @@ -19,6 +19,7 @@ foreman_proxy::module { 'tftp': enabled => $enabled, + feature => 'TFTP', listen_on => $listen_on, } } diff --git a/spec/defines/foreman_proxy_module_spec.rb b/spec/defines/foreman_proxy_module_spec.rb index 8822f307..1d827b02 100644 --- a/spec/defines/foreman_proxy_module_spec.rb +++ b/spec/defines/foreman_proxy_module_spec.rb @@ -10,7 +10,7 @@ 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 @@ -18,7 +18,7 @@ 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') } @@ -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