I’ve been putting off the upgrade to 0.10 for a while now because things
broke horribly when I first tried 0.10 on Windows. Trying 0.10.6-beta2,
things seem to have changed for the worse - I can’t even complete a Chef run
It appears that Windows commands executed with ShellOut are regularly
returning exit code 42 on success. I can work around this for the main
"execute" blocks by specifying the return code, but for those protected with
"not_if", commands get run that shouldn’t be as the check performed is
exit_code!=0. For example, the following old block is near the top of my
run list (I realise that this could be replaced with a user block):
execute “net user chef /ADD /MOREHERE” do
not_if “net user chef”
What happens is:
DEBUG: Executing net user chef
DEBUG: Ran net user chef returned 42
<the net user chef /ADD /MOREHERE" command then gets run>
When I run “net user chef” manually, I get return code 0.
If I use chef 0.9.18, this works without any problems. With 0.10.0, chef
ran ok but I had some problems with search results appearing and vanishing a
few seconds later on the server.
Is there a way to use “not_if” in a straightforward fashion in Windows?