Hi,
I use the package resource to install a application which ends and returns the success code.
As its a large complex app I’d also like to do a sanity check in the logs to see that it actually was completed and end the run if fails. I.e. I don’t think I can just reply on the package return code.
powershell_script ‘Confirm Installation Successful’ do
code <<-EOH
$file = Get-Content “E:\Apps\Appx\technical_installation.log”
$containsWord = file | %{_ -match “Applicationx Version 1.1.1.1 – Installation operation completed successfully”}
if ($containsWord -contains $true) {
Chef::Log.info(‘Upgrade Sucessful’)
} else {
Chef::Log.fatal(‘Upgrade failed’)
}
EOH
end
I’m mixing Powershell and native Chef with the “Chef::Log.info(‘Upgrade Sucessful’)” & “Chef::Log.fatal(‘Upgrade failed’)” so doesn’t work.
How do others do this type of checking in the Chef windows world?
Many thanks