diff --git a/spec/classes/foreman_spec.rb b/spec/classes/foreman_spec.rb index 35e4a2d6..ede87385 100644 --- a/spec/classes/foreman_spec.rb +++ b/spec/classes/foreman_spec.rb @@ -484,6 +484,17 @@ it { should contain_user('foreman').with('groups' => []) } end + + describe 'with sensitive passwords' do + let(:params) do + super().merge(db_password: sensitive('secret')) + end + + it 'should configure the database' do + should contain_file('/etc/foreman/database.yml') + .with_content(/password: "secret"/) + end + end end end end diff --git a/templates/database.yml.epp b/templates/database.yml.epp index 7e45e262..444cdfd1 100644 --- a/templates/database.yml.epp +++ b/templates/database.yml.epp @@ -30,6 +30,6 @@ username: <%= $username %> <% } -%> <% if $password { -%> - password: "<%= $password %>" + password: <%= stdlib::to_ruby($password) %> <% } -%> pool: <%= $db_pool %>