Hi All,
In my release deployment through chef, I would like to execute DBA actions
through chef.
This is the code snippet that I will be using to run DBA actions.
node[:release][:rel_dir] is same as d:\release.
powershell_script ‘Execute DBA Actions’ do
cwd Chef::node[:release][:rel_dir]
code <<-EOH
Start-Process -WorkingDirectory “D:\release” -FilePath “cmd.exe”
-ArgumentList “/k UpdateDB.bat zeyt sa abcde” -Verb runAs
EOH
end
here UpdateDb.bat is batch script that will accept arguments as
database_name, username and password . the syntax is
runSQL^
jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver^
uri=jdbc:sqlserver://10.10.10.10;DatabaseName=ZEYT;encrypt=false^
user=%2^
password=%3^
input.file=sql\DBUpdate.txt^
error.handling=EXIT^
output.verbose=%5
When I am executing powershell script this way, updateDB.bat is executed
through cmd.exe and chef has no control over it. Is it fine to execute a
second script this way??
or do I need to put some guards to check until the script is executed
completely like WaitforExit().
Any idea how to deal these use cases.
Thanks,
Sachin