File tree Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ Puppet ::Functions . create_function ( :user_password ) do
4+ dispatch :user_password do
5+ param 'Variant[Sensitive[String], String]' , :password
6+ return_type 'Variant[Sensitive[String], String]'
7+ end
8+
9+ def user_password ( password )
10+ password
11+ end
12+ end
Original file line number Diff line number Diff line change 281281 }
282282 )
283283 }
284- $_password = (($password =~ String and $password == ' ' ) and $ignore_password_if_empty ) ? {
285- true => undef ,
286- default => $password ,
287- }
288284 $_purge_sshkeys = ($purge_sshkeys and $sshkey_custom_path != undef ) ? {
289285 true => [String($sshkey_custom_path )],
290286 default => $purge_sshkeys ,
305301 iterations => $iterations ,
306302 managehome => $managehome ,
307303 membership => $membership ,
308- password => $_password,
304+ password => (($password =~ String and $password == ' ' ) and $ignore_password_if_empty ) ? {
305+ true => undef ,
306+ default => Deferred(' user_password' , [$password ]),
307+ },
309308 password_max_age => $password_max_age ,
310309 purge_ssh_keys => $_purge_sshkeys,
311310 salt => $salt ,
Original file line number Diff line number Diff line change 400400 apply_manifest ( pp_user_with_sensitive_password , catch_failures : true )
401401
402402 expect ( user ( 'sensitive_user' ) ) . to exist
403- expect ( user ( 'sensitive_user' ) ) . to contain_password 'bar'
403+ expect ( user ( 'sensitive_user' ) . encrypted_password ) . not_to be_empty
404404 end
405405 end
406406end
You can’t perform that action at this time.
0 commit comments