[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Odd ReturnsZero function problem -- Re: defining classes based on re
From: |
Mark Burgess |
Subject: |
Re: Odd ReturnsZero function problem -- Re: defining classes based on returning results of (shell) commands? |
Date: |
Fri, 25 Aug 2006 11:29:03 +0200 |
User-agent: |
Thunderbird 1.5.0.5 (X11/20060725) |
Robinson Tiemuqinke wrote:
> Hi,
>
> Thanks for example. But which version of cfengine are
> you running?
>
> I'm using cfengine 2.1.18 and the ReturnsZero
> function always thinks that the included commands
> returns zero (success)!! -- pretty Odd and Funny!
>
> See my example:
> ...
> netBoot = ( ReturnsZero(/bin/sh -c
> "PATH=/bin:/usr/bin:/sbin:/usr/sbin ;
> mount | egrep '^/dev/ram.*?[ \t]+on[ \t]*/[ \t]*'
>> /dev/null 2>&1") )
> localBoot = ( ReturnsZero(/bin/sh -c
> "PATH=/bin:/usr/bin:/sbin:/usr/sbin ;
> mount | egrep '^/dev/[sh]da.*?[ \t]+on[ \t]*/[
> \t]*' > /dev/null 2>&1") )
> ...
>
> Only one shoud be true, either from ramdisk
> (/dev/ram?) or local disk (/dev/[sh]da) my machines
> will find its root file system. But see what? cfengine
> sets both netBoot and localBoot classes at the same
> time on any machines!
>
> from command line we can see that one command returns
> exit code 0, anther one returns 1 if we run the above
> encolsed commands manually.
>
> Please help.
>
You are using a shell wrapper -- the shell can exit cleanly evn though
the child process doesn't...