The ha_vrrp_auth_password password should be secret

Change-Id: Ieaf1507ca63b2ab72c666f6e308a70c937524eb0
This commit is contained in:
Takashi Kajinami 2021-09-23 22:18:40 +09:00
parent 41e4be6d95
commit 8baf515b16
3 changed files with 24 additions and 2 deletions

View File

@ -14,6 +14,28 @@ Puppet::Type.newtype(:neutron_l3_agent_config) do
value.capitalize! if value =~ /^(true|false)$/i
value
end
def is_to_s( currentvalue )
if resource.secret?
return '[old secret redacted]'
else
return currentvalue
end
end
def should_to_s( newvalue )
if resource.secret?
return '[new secret redacted]'
else
return newvalue
end
end
end
newparam(:secret, :boolean => true) do
desc 'Whether to hide the value from Puppet logs. Defaults to `false`.'
newvalues(:true, :false)
defaultto false
end
newparam(:ensure_absent_val) do

View File

@ -171,7 +171,7 @@ class neutron::agents::l3 (
if $ha_enabled {
neutron_l3_agent_config {
'DEFAULT/ha_vrrp_auth_type': value => $ha_vrrp_auth_type;
'DEFAULT/ha_vrrp_auth_password': value => $ha_vrrp_auth_password;
'DEFAULT/ha_vrrp_auth_password': value => $ha_vrrp_auth_password, secret => true;
'DEFAULT/ha_vrrp_advert_int': value => $ha_vrrp_advert_int;
}
}

View File

@ -110,7 +110,7 @@ describe 'neutron::agents::l3' do
end
it 'should configure VRRP' do
should contain_neutron_l3_agent_config('DEFAULT/ha_vrrp_auth_type').with_value(p[:ha_vrrp_auth_type])
should contain_neutron_l3_agent_config('DEFAULT/ha_vrrp_auth_password').with_value(p[:ha_vrrp_auth_password])
should contain_neutron_l3_agent_config('DEFAULT/ha_vrrp_auth_password').with_value(p[:ha_vrrp_auth_password]).with_secret(true)
should contain_neutron_l3_agent_config('DEFAULT/ha_vrrp_advert_int').with_value(p[:ha_vrrp_advert_int])
end
end