- From: Noah Kantrowitz <
>
- To:
- Subject: [chef] Re: mixliv command run_command executed at compile time ?
- Date: Fri, 7 Feb 2014 10:13:21 -0800
On Feb 7, 2014, at 10:07 AM, Cyril Scetbon
<
>
wrote:
>
Hi,
>
>
When the command used in the Mixlib::ShellOut.new does not exist, chef
>
exits with a compilation error
>
>
================================================================================
>
Recipe Compile Error in /tmp/cookbooks/hadoop/recipes/default.rb
>
================================================================================
>
>
>
Errno::ENOENT
>
-------------
>
No such file or directory - echo2 ok
>
>
>
In the following example it should start and exists as it should not find
>
package whois2
>
>
include_recipe "apt"
>
>
package "whois2" do
>
action :install
>
end
>
>
cmd = Mixlib::ShellOut.new("echo2 ok")
>
cmd.run_command
>
>
However, it exists with :
>
>
[2014-02-07T18:00:28+00:00] DEBUG: Re-raising exception: Errno::ENOENT - No
>
such file or directory - echo2 ok
>
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mixlib-shellout-1.2.0/lib/mixlib/shellout/unix.rb:268:in
>
`exec'
>
>
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mixlib-shellout-1.2.0/lib/mixlib/shellout/unix.rb:268:in
>
`block in fork_subprocess'
>
>
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mixlib-shellout-1.2.0/lib/mixlib/shellout/unix.rb:256:in
>
`fork'
>
>
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mixlib-shellout-1.2.0/lib/mixlib/shellout/unix.rb:256:in
>
`fork_subprocess'
>
>
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mixlib-shellout-1.2.0/lib/mixlib/shellout/unix.rb:40:in
>
`run_command'
>
>
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mixlib-shellout-1.2.0/lib/mixlib/shellout.rb:225:in
>
`run_command'
>
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/hadoop/recipes/default.rb:19:in
>
`from_file'
>
>
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/mixin/from_file.rb:30:in
>
`instance_eval'
>
>
If I replace "echo2" by "echo" it exits with the expected error.
>
>
I suppose it's not an expected behaviour ? FYI, I used chef-solo 11.8.2
Chef uses a two-pass system, first it evaluates all recipes to build the
resource collection, then it converges each resource. Any top-level ruby code
happens in the first phase, so that error happens first.
--Noah
Attachment:
signature.asc
Description: Message signed with OpenPGP using GPGMail
Archive powered by MHonArc 2.6.16.