help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ReturnsZero(): command does not return zero. Is class created with v


From: Hans Deragon
Subject: Re: ReturnsZero(): command does not return zero. Is class created with value of false?
Date: Wed, 01 Oct 2003 14:54:54 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030905

This issue is definitively a bug with version 2.1.0b2. I tried my cf script unchanged with 2.0.7p3 and it worked flawlessly.


Best regards,
Hans Deragon
--
Consultant en informatique/Software Consultant
Deragon Informatique inc.         Open source:
http://www.deragon.biz            http://swtmvcwrapper.sourceforge.net
mailto://hans@deragon.biz         http://autopoweroff.sourceforge.net


-------- Original Message --------
Message-ID: <3F7AD8EF.9040201@deragon.biz>
Date: Wed, 01 Oct 2003 09:38:55 -0400
From: Hans Deragon <hans@deragon.biz>
Organization: Deragon Informatique inc.
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030905
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: help-cfengine@gnu.org
Subject: Re: ReturnsZero(): command does not return zero. Is class created with value of false?
References: <200310010425.h914PIFF020234@nexus.iu.hio.no>
In-Reply-To: <200310010425.h914PIFF020234@nexus.iu.hio.no>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Mark.Burgess@iu.hio.no wrote:
I'm sorry -- I didn't read this properly first time
around. the problem is a misunderstanding of the ReturnZero()
function. It is the value of the shell returncode that is tested
not the value of the text string printed by the command.
You will need to use StrCmp("0",$returnvar) if you want to test that.
Since fgrep will always succeed if /etc/passwd exists, it will always
return zero in the sense of ReturnZero().

...and again, you still have not read properly (or understand fgrep return
codes). :)  What I do is check for a user in the /etc/passwd:

[qhander@snah1 qhander] /bin/fgrep -c lmclxadm /etc/passwd
0
[qhander@snah1 qhander] echo $?
1

So the return code is 1.  accountexist is therefore not defined.  !accountexist
should trigger, but it does not.  Bug.

I believe it is explained in the manual that classes are attributes
that are either defined or not. It is certainly implicit in all
of the docs, but whether or not it is clear is of course a matter
of opinion! :)

Mark

Mmmm... I would have brought a few changes to the documentation to make it
clearer.  But, now that I know...





reply via email to

[Prev in Thread] Current Thread [Next in Thread]