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: Mark . Burgess
Subject: Re: ReturnsZero(): command does not return zero. Is class created with value of false?
Date: Thu, 2 Oct 2003 07:55:26 +0200 (MEST)

I don't have time to check this now,  but perhaps the problem is
that you need to put the class in AddINstallables = (... ). It
could be a declaration issue. No code related to this has changed since
2.0.7

M

On  1 Oct, Hans Deragon wrote:
> 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...
> 
> 
> Thanks,
> 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
> 
> 
> 
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-cfengine



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Work: +47 22453272            Email:  Mark.Burgess@iu.hio.no
Fax : +47 22453205            WWW  :  http://www.iu.hio.no/~mark
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





reply via email to

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