Hello, Can anyone explain me why this ""execute" runs ? execute "dash" do command "echo dash" only_if { "ls -l /bin/sh|grep dash" } end [2014-01-21T18:53:13+00:00] INFO: *** Chef 11.8.2 *** [2014-01-21T18:53:13+00:00] INFO: Chef-client pid: 1656 [2014-01-21T18:53:15+00:00] INFO: Setting the run_list to ["recipe[cassandra::test]"] from JSON [2014-01-21T18:53:15+00:00] INFO: Run List is [recipe[cassandra::test]] [2014-01-21T18:53:15+00:00] INFO: Run List expands to [cassandra::test] [2014-01-21T18:53:15+00:00] INFO: Starting Chef Run for vagrant [2014-01-21T18:53:15+00:00] INFO: Running start handlers [2014-01-21T18:53:15+00:00] INFO: Start handlers complete. [2014-01-21T18:53:18+00:00] INFO: execute[dash] ran successfully [2014-01-21T18:53:18+00:00] INFO: Chef Run complete in 2.304952258 seconds [2014-01-21T18:53:18+00:00] INFO: Running report handlers [2014-01-21T18:53:18+00:00] INFO: Report handlers complete [2014-01-21T18:53:13+00:00] INFO: Forking chef instance to converge... $ ls -l /bin/sh|grep dash :~$ echo $? 1 I can prevent it from running with a not_if statement, but I don't understand why the previous only_if doesn't work : execute "dash" do command "echo dash" not_if { "ls -l /bin/sh|grep bash" } end [2014-01-21T18:56:12+00:00] INFO: Forking chef instance to converge... [2014-01-21T18:56:12+00:00] INFO: *** Chef 11.8.2 *** [2014-01-21T18:56:12+00:00] INFO: Chef-client pid: 2342 [2014-01-21T18:56:14+00:00] INFO: Setting the run_list to ["recipe[cassandra::test]"] from JSON [2014-01-21T18:56:14+00:00] INFO: Run List is [recipe[cassandra::test]] [2014-01-21T18:56:14+00:00] INFO: Run List expands to [cassandra::test] [2014-01-21T18:56:14+00:00] INFO: Starting Chef Run for vagrant [2014-01-21T18:56:14+00:00] INFO: Running start handlers [2014-01-21T18:56:14+00:00] INFO: Start handlers complete. [2014-01-21T18:56:16+00:00] INFO: Chef Run complete in 1.273026178 seconds [2014-01-21T18:56:16+00:00] INFO: Running report handlers [2014-01-21T18:56:16+00:00] INFO: Report handlers complete [2014-01-21T18:56:12+00:00] INFO: Forking chef instance to converge... $ ls -l /bin/sh|grep bash lrwxrwxrwx 1 root root 4 Jan 21 17:39 /bin/sh -> bash $ echo $? 0 Is there anything wrong in my only_if statement that make it runs while it shouldn't ? Thanks
--
Cyril SCETBON |
Archive powered by MHonArc 2.6.16.