help-cfengine
[Top][All Lists]
Advanced

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

RE: Problems with ExecResult & ReturnsZero in 2.1.18


From: Martin, Jason H
Subject: RE: Problems with ExecResult & ReturnsZero in 2.1.18
Date: Thu, 29 Dec 2005 10:44:07 -0800

I was more concerned about this:

> > > This works:
> > > 
> > > HomePart = ( ReturnsZero("/bin/sh -c \"df -l | grep \'^/dev\' 
> > > | awk \'{print $NF}\' | grep -q \'^/home$\'\"") )
> > > enterprise$ ./cfagent -f ./cftest -p
> > > Filesystem           1K-blocks      Used Available Use% Mounted on
> > > /dev/hda6             28573840   9946040  18627800  35% /
> > > tmpfs                   517792         0    517792   0% /dev/shm
> > > /dev/hda1             24648696  12643940  12004756  52% /windows/C

If the example stated as working generated output of df, then it failed
-- grep -q should generate no output.  I don't see how you got the
listed output from the given script sequence.

Thank you,
-Jason Martin

> -----Original Message-----
> From: Mark Burgess [mailto:Mark.Burgess@iu.hio.no] 
> Sent: Thursday, December 29, 2005 10:24 AM
> To: Martin, Jason H
> Cc: Brandon Evans; help-cfengine@gnu.org
> Subject: RE: Problems with ExecResult & ReturnsZero in 2.1.18
> 
> 
> 
> 
> That's because the quotes disappear when they are not escaped.
> So this works as it should
> 
> 
> 
> 
> VarPart = ( ReturnsZero("/bin/sh -c \"df -l | grep \'^/dev\' | awk
> \'{print $NF}\' | grep -q \'^/var$\'\"") )
>  
> 
> 
> On Thu, 2005-12-29 at 08:37 -0800, Martin, Jason H wrote:
> > Utilizing grep -q should result in no output at all. It 
> looks like cfe
> > is only honoring the first pipe character.  Neither the awk 
> nor grep -q
> > is being executed in the 'working' example output posted.
> > 
> > -Jason Martin
> > 
> > 
> > 
> > > -----Original Message-----
> > > From: 
> > > help-cfengine-bounces+jason.h.martin=cingular.com@gnu.org 
> > > [mailto:help-cfengine-bounces+jason.h.martin=cingular.com@gnu.
> > > org] On Behalf Of Mark Burgess
> > > Sent: Wednesday, December 28, 2005 11:52 PM
> > > To: Brandon Evans
> > > Cc: help-cfengine@gnu.org
> > > Subject: Re: Problems with ExecResult & ReturnsZero in 2.1.18
> > > 
> > > 
> > > 
> > > This works:
> > > 
> > > HomePart = ( ReturnsZero("/bin/sh -c \"df -l | grep \'^/dev\' 
> > > | awk \'{print $NF}\' | grep -q \'^/home$\'\"") )
> > > 
> > > VarPart = ( ReturnsZero(/bin/sh -c "df -l | grep '^/dev' | 
> > > awk '{print $NF}' | grep -q '^/var$'") )
> > >  
> > > BootPart = ( ReturnsZero(/bin/sh -c "df -l | grep '^/dev' | 
> > > awk '{print $NF}' | grep -q '^/boot$'") )
> > > 
> > > It yields:
> > > 
> > > enterprise$ ./cfagent -f ./cftest -p
> > > Filesystem           1K-blocks      Used Available Use% Mounted on
> > > /dev/hda6             28573840   9946040  18627800  35% /
> > > tmpfs                   517792         0    517792   0% /dev/shm
> > > /dev/hda1             24648696  12643940  12004756  52% /windows/C
> > > Filesystem           1K-blocks      Used Available Use% Mounted on
> > > /dev/hda6             28573840   9946040  18627800  35% /
> > > tmpfs                   517792         0    517792   0% /dev/shm
> > > /dev/hda1             24648696  12643940  12004756  52% 
> /window-s/C
> > > 
> > > for 2.1.18
> > > 
> > > On Wed, 2005-12-28 at 19:31 -0800, Brandon Evans wrote:
> > > > 
> > > > I just upgraded to cfengine 2.1.18 for 2.1.15.  I am now having 
> > > > problems
> > > > with ExecResult and ReturnsZero.
> > > > 
> > > > First off, ReturnsZero is now spitting out the results of some 
> > > > commands
> > > > where it didnt before.
> > > > 
> > > > To check for diffirent partations I use the bellow commands:
> > > > 
> > > > HomePart = ( ReturnsZero(/bin/sh -c "df -l | grep '^/dev' | awk 
> > > > '{print
> > > > $NF}' | grep -q '^/home$'") )
> > > >   VarPart = ( ReturnsZero(/bin/sh -c "df -l | grep '^/dev' 
> > > | awk '{print 
> > > > $NF}' | grep -q '^/var$'") )
> > > >   BootPart = ( ReturnsZero(/bin/sh -c "df -l | grep 
> '^/dev' | awk 
> > > > '{print $NF}' | grep -q '^/boot$'") )
> > > > 
> > > > 
> > > > Running cfagent from the command line produces the 
> following output:
> > > > 
> > > > Filesystem           1K-blocks      Used Available Use% 
> Mounted on
> > > > /dev/md1              10080428   4525756   5042608  48% /
> > > > /dev/md2                101018      8702     87100  10% /boot
> > > > /dev/md0             106950584  34919112  66598700  35% /home
> > > > none                   1034088         0   1034088   0% /dev/shm
> > > > Filesystem           1K-blocks      Used Available Use% 
> Mounted on
> > > > /dev/md1              10080428   4525756   5042608  48% /
> > > > /dev/md2                101018      8702     87100  10% /boot
> > > > /dev/md0             106950584  34919112  66598700  35% /home
> > > > none                   1034088         0   1034088   0% /dev/shm
> > > > Filesystem           1K-blocks      Used Available Use% 
> Mounted on
> > > > /dev/md1              10080428   4525756   5042608  48% /
> > > > /dev/md2                101018      8702     87100  10% /boot
> > > > /dev/md0             106950584  34919112  66598700  35% /home
> > > > none                   1034088         0   1034088   0% /dev/shm
> > > > 
> > > > 
> > > > I know others have been having problems with pipes
> > > > 
> (http://www.mail-archive.com/help-cfengine@gnu.org/msg01816.ht
ml)
> > > but no quoting I try works.  What changed from 2.1.15 to 
> > 2.1.18?  I can 
> > > no longer use ReturnsZero.  ExecResult and ExecShellResult 
> > don't seem to 
> > > be working either.
> > > 
> > > Can someone post a working Example of any of these commands 
> > that works
> > > with 2.1.18?
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > 
> > 
> > 
> > _______________________________________________
> > Help-cfengine mailing list
> > Help-cfengine@gnu.org 
> > http://lists.gnu.org/mailman/listinfo/help-> cfengine
> > 





reply via email to

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