[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: ReturnsZero(): command does not return zero. Is class createdwith va
From: |
Villalovos, John L |
Subject: |
RE: ReturnsZero(): command does not return zero. Is class createdwith value of false? |
Date: |
Tue, 27 Apr 2004 09:52:22 -0700 |
Is anyone using ReturnsZero() sucessfully? Since I have upgraded it
appears to be broken :(
John
-----------------------------
From: help-cfengine-bounces+john.l.villalovos=intel.com@gnu.org
[mailto:help-cfengine-bounces+john.l.villalovos=intel.com@gnu.org] On
Behalf Of Villalovos, John L
Sent: Friday, April 23, 2004 8:10 AM
To: Help-Cfengine (E-mail)
Subject: RE: ReturnsZero(): command does not return zero. Is class
createdwith value of false?
Has anything happened on this issue?
I just upgraded from 2.0.7p3 to 2.1.5 and now my ReturnsZero statements
don't seem to work anymore :(
groups:
# The web server is called httpd in Red Hat 8.0 forward
hasWebServer_rh8 = ( ReturnsZero(/bin/rpm -q --quiet httpd) )
# The web server is called apache in Red Hat 7.x
hasWebServer_rh7 = ( ReturnsZero(/bin/rpm -q --quiet apache) )
# See if phpMyAdmin is installed
has_phpMyAdmin = ( ReturnsZero(/bin/rpm -q --quiet phpMyAdmin) )
shellcommands:
webServer.redhat_7.!hasWebServer_rh7::
"/usr/sbin/up2date apache"
"/sbin/chkconfig httpd on"
"/sbin/service httpd start"
webServer.redhat_8.!hasWebServer_rh8::
"/usr/sbin/up2date httpd"
"/sbin/chkconfig httpd on"
"/sbin/service httpd start"
# Install phpMyAdmin if a phpMyAdmin server
phpMyAdminServer.!has_phpMyAdmin::
"/usr/sbin/up2date phpMyAdmin"
After upgrading to 2.1.5, none of my ReturnsZero commands are working.
The classes are not being created.
John
wrote:
> 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
>
> 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...
>
>
>
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-cfengine
_______________________________________________
Help-cfengine mailing list
Help-cfengine@gnu.org
http://mail.gnu.org/mailman/listinfo/help-cfengine
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- RE: ReturnsZero(): command does not return zero. Is class createdwith value of false?,
Villalovos, John L <=