powershell_script "testDynamicCompressionLevel" do
code <<-EOB
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.webServer/httpCompression/
'gzip']" -name "dynamicCompressionLevel" -value 4
EOB
not_if 'powershell -noninteractive -noprofile -command "exit [int32]((get-WebConfigurationProperty -pspath "MACHINE/WEBROOT/APPHOST" -filter "system.webServer/httpCompression/
"gzip"]" -name "dynamicCompressionLevel").value -eq 4)"'
end
on machine 1 the powershell command in the not_if evaluated to false (because its set to 0) I run this command from the prompt on the machine locally.
upon chef-client i get the following lines:
[2014-02-25T13:23:16-05:00] INFO: powershell_script[testDynamicCompressionLevel] ran successfully
- execute "powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy RemoteSigned -InputFormat None -File
"C:/Users/kbarry-x/AppData/Local/Temp/chef-script20140225-2672-jjmxxc.ps1"
and not the setting is '4', so the test evaluates as true
but when I chef-client again i get the same results, instead of a "skipped due to not_if"