Skip to content

Commit b999ea3

Browse files
committed
(maint) Fix warning introduced in 08a1752
`unless` does not accept a Sensitive parameter, and passing one result in a warning being output: ``` (/Postgresql_psql[ALTER ROLE puppetdb ENCRYPTED PASSWORD ****]) Unable to mark 'unless' as sensitive: unless is a parameter and not a property, and cannot be automatically redacted. ``` This is not really an issue here since this query is not displayed in the logs, even in debug mode.
1 parent 587fc12 commit b999ea3

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

manifests/server/role.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
}
134134
postgresql_psql { "ALTER ROLE ${username} ENCRYPTED PASSWORD ****":
135135
command => Sensitive("ALTER ROLE \"${username}\" ${password_sql}"),
136-
unless => Sensitive("SELECT 1 FROM pg_shadow WHERE usename = '${username}' AND passwd = '${pwd_hash_sql}'"),
136+
unless => "SELECT 1 FROM pg_shadow WHERE usename = '${username}' AND passwd = '${pwd_hash_sql}'",
137137
sensitive => true,
138138
}
139139
}

spec/unit/defines/server/role_spec.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
is_expected.to contain_postgresql_psql('ALTER ROLE test ENCRYPTED PASSWORD ****')
4343
.with('command' => 'Sensitive [value redacted]',
4444
'sensitive' => 'true',
45-
'unless' => 'Sensitive [value redacted]',
45+
'unless' => "SELECT 1 FROM pg_shadow WHERE usename = 'test' AND passwd = 'md5b6f7fcbbabb4befde4588a26c1cfd2fa'",
4646
'port' => '5432')
4747
end
4848

@@ -74,7 +74,8 @@
7474
it 'has alter role for "test" user with password as ****' do
7575
is_expected.to contain_postgresql_psql('ALTER ROLE test ENCRYPTED PASSWORD ****')
7676
.with('command' => 'Sensitive [value redacted]', 'sensitive' => 'true',
77-
'unless' => 'Sensitive [value redacted]', 'port' => '5432',
77+
'unless' => "SELECT 1 FROM pg_shadow WHERE usename = 'test' AND passwd = 'md5b6f7fcbbabb4befde4588a26c1cfd2fa'",
78+
'port' => '5432',
7879
'connect_settings' => { 'PGHOST' => 'postgres-db-server', 'DBVERSION' => '9.1',
7980
'PGUSER' => 'login-user', 'PGPASSWORD' => 'login-pass' })
8081
end
@@ -107,7 +108,7 @@
107108
it 'has alter role for "test" user with password as ****' do
108109
is_expected.to contain_postgresql_psql('ALTER ROLE test ENCRYPTED PASSWORD ****')
109110
.with('command' => 'Sensitive [value redacted]', 'sensitive' => 'true',
110-
'unless' => 'Sensitive [value redacted]',
111+
'unless' => "SELECT 1 FROM pg_shadow WHERE usename = 'test' AND passwd = 'md5b6f7fcbbabb4befde4588a26c1cfd2fa'",
111112
'connect_settings' => { 'PGHOST' => 'postgres-db-server', 'DBVERSION' => '9.1',
112113
'PGPORT' => '1234', 'PGUSER' => 'login-user', 'PGPASSWORD' => 'login-pass' })
113114
end

0 commit comments

Comments
 (0)