@@ -43,11 +43,12 @@ def add_features(features)
4343 def modify_features ( features , action )
4444 if not_nil_and_not_empty? features
4545 debug "#{ action . capitalize } ing features '#{ features . join ( ',' ) } '"
46- cmd_args = build_cmd_args ( features , action )
46+ cmd_args , obfuscated_strings = build_cmd_args ( features , action )
47+
4748 begin
4849 config_file = create_temp_for_install_switch unless action == 'uninstall'
4950 cmd_args << "/ConfigurationFile=\" #{ config_file . path } \" " unless config_file . nil?
50- try_execute ( cmd_args , "Error trying to #{ action } features (#{ features . join ( ', ' ) } " )
51+ try_execute ( cmd_args , "Error trying to #{ action } features (#{ features . join ( ', ' ) } " , obfuscated_strings )
5152 ensure
5253 if config_file
5354 config_file . close
@@ -118,17 +119,21 @@ def basic_cmd_args(features, action)
118119
119120 def build_cmd_args ( features , action = "install" )
120121 cmd_args = basic_cmd_args ( features , action )
122+ obfuscated_strings = [ ]
121123 if action == 'install'
122124 %w( pid sa_pwd sql_svc_account sql_svc_password agt_svc_account agt_svc_password as_svc_account as_svc_password rs_svc_account rs_svc_password security_mode ) . map ( &:to_sym ) . sort . collect do |key |
123125 if not_nil_and_not_empty? @resource [ key ]
124126 cmd_args << "/#{ key . to_s . gsub ( /_/ , '' ) . upcase } =\" #{ @resource [ key ] } \" "
127+ if key . to_s =~ /(_pwd|_password)$/i
128+ obfuscated_strings . push ( @resource [ key ] )
129+ end
125130 end
126131 end
127132
128133 format_cmd_args_array ( '/SQLSYSADMINACCOUNTS' , @resource [ :sql_sysadmin_accounts ] , cmd_args , true )
129134 format_cmd_args_array ( '/ASSYSADMINACCOUNTS' , @resource [ :as_sysadmin_accounts ] , cmd_args )
130135 end
131- cmd_args
136+ return cmd_args , obfuscated_strings
132137 end
133138
134139 def format_cmd_args_array ( switch , arr , cmd_args , use_discrete = false )
0 commit comments