@@ -155,11 +155,23 @@ def base_install(sql_version, resource_root)
155155 features = [ 'DQ' , 'FullText' , 'Replication' , 'SQLEngine' ]
156156 install_sqlserver ( features )
157157
158- reboot ( )
159- # Remount the ISO on the agent
160- mount_iso ( i_iso_opts )
161- mount_iso ( h_iso_opts )
162- install_sqlserver ( features )
158+ # reboot()
159+ # # Remount the ISO on the agent
160+ # mount_iso(i_iso_opts)
161+ # mount_iso(h_iso_opts)
162+ # install_sqlserver(features)
163+ end
164+
165+ def node_user?
166+ hash = Helper . instance . inventory_hash_from_inventory_file
167+
168+ hash [ 'groups' ] . each do |group |
169+ group [ 'targets' ] . each do |node |
170+ if ENV [ 'TARGET_HOST' ] == node [ 'uri' ]
171+ return node [ 'config' ] [ 'winrm' ] [ 'user' ]
172+ end
173+ end
174+ end
163175end
164176
165177def install_sqlserver ( features )
@@ -170,7 +182,7 @@ def install_sqlserver(features)
170182 features => #{ features } ,
171183 security_mode => 'SQL',
172184 sa_pwd => 'Pupp3t1@',
173- sql_sysadmin_accounts => ['Administrator '],
185+ sql_sysadmin_accounts => ['#{ node_user? } '],
174186 install_switches => {
175187 'TCPENABLED' => 1,
176188 'SQLBACKUPDIR' => 'C:\\ MSSQLSERVER\\ backupdir',
@@ -183,7 +195,7 @@ def install_sqlserver(features)
183195 windows_feature_source => 'I:\\ sources\\ sxs',
184196 }
185197 MANIFEST
186- Helper . instance . apply_manifest ( pp )
198+ Helper . instance . apply_manifest ( pp , catch_failures : true )
187199end
188200
189201def reboot ( )
0 commit comments