- From: AJ Christensen <
>
- To:
- Subject: [chef] Re: Re: Re: Re: testing for mounted fs, and trying shell_out
- Date: Wed, 26 Sep 2012 10:15:27 +1200
ShellOut also has a #shell_out! (bang) method, which checks the exit status:
https://github.com/opscode/chef/blob/master/chef/lib/chef/mixin/shell_out.rb#L34-38
Cheers,
AJ
On 26 September 2012 10:10, Brasic, Carl
<
>
wrote:
>
On Tue, Sep 25, 2012 at 4:43 PM,
>
<
>
>
wrote:
>
> cool... so my approach to the task using shell_out and begin/rescue is
>
> sane, if not good?
>
>
Seems like you're expecting shell_out to raise an exception if the
>
grep command doesn't find the mount. That's not how shell_out works,
>
so your rescue block will never run.
>
Instead you should be checking #exitstatus:
>
>
if node['ec2']
>
ebs_mounted = shell_out("grep /ebs /proc/mounts 2>&1 | grep -q
>
md[1-9]").exitstatus.zero?
>
end
>
>
Thanks,
>
Carl
Archive powered by MHonArc 2.6.16.