@@ -43,11 +43,12 @@ def add_features(features)
43
43
def modify_features ( features , action )
44
44
if not_nil_and_not_empty? features
45
45
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
+
47
48
begin
48
49
config_file = create_temp_for_install_switch unless action == 'uninstall'
49
50
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 )
51
52
ensure
52
53
if config_file
53
54
config_file . close
@@ -118,17 +119,21 @@ def basic_cmd_args(features, action)
118
119
119
120
def build_cmd_args ( features , action = "install" )
120
121
cmd_args = basic_cmd_args ( features , action )
122
+ obfuscated_strings = [ ]
121
123
if action == 'install'
122
124
%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 |
123
125
if not_nil_and_not_empty? @resource [ key ]
124
126
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
125
130
end
126
131
end
127
132
128
133
format_cmd_args_array ( '/SQLSYSADMINACCOUNTS' , @resource [ :sql_sysadmin_accounts ] , cmd_args , true )
129
134
format_cmd_args_array ( '/ASSYSADMINACCOUNTS' , @resource [ :as_sysadmin_accounts ] , cmd_args )
130
135
end
131
- cmd_args
136
+ return cmd_args , obfuscated_strings
132
137
end
133
138
134
139
def format_cmd_args_array ( switch , arr , cmd_args , use_discrete = false )
0 commit comments