help-cfengine
[Top][All Lists]
Advanced

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

Re: Pipes & ExecResult/ReturnsZero


From: Mark Burgess
Subject: Re: Pipes & ExecResult/ReturnsZero
Date: Wed, 21 Dec 2005 18:05:09 +0100

Are you using the snapshot, rather than the sources from svn? I see that
looks out of date

M

On Wed, 2005-12-21 at 11:06 -0500, christian pearce wrote:
> cf:cfengine::/var/cfengine/inputs/sysnav-update.conf:81: Use of
> Exec[Shell]Result(s) outside of variable assignment
> 
> [root@hsysnav02 src]# head -81 /var/cfengine/inputs/sysnav-update.conf
>  | tail -3
> groups:
> 
>     crontab_exists  = ( ReturnsZero(${sh} -c '${crontab} -l | ${grep}
> sysnav-cfexecd > /dev/null') )
> 
> 
>  PRIVATE char *BUILTINS[] =    /* The actions which may be specified
> as indexed */ in globals.c
> 
> doesn't have execshellresult. So FunctionStringToCode breaks in function.c
> 
> On 11/30/05, Mark Burgess <Mark.Burgess@iu.hio.no> wrote:
> > It *should* work with *some* older releases, but a bug was identified
> > so I guess it doesn't :) Recommend the patch
> >
> > M
> >
> > On Wed, 2005-11-30 at 08:11 -0800, Martin, Jason H wrote:
> > > Should that quoting style work with older releases? When I use that in a
> > > 2.1.14/Solaris config, it blows up:
> > >
> > > root_homedir = ( ExecResult("/bin/sh -c \"/usr/bin/grep root:
> > > /etc/passwd | /usr/bin/awk -F: '{print $6}'\"") )
> > > cf:cfengine::/var/cfengine/inputs/cfagent.conf:661: ExecResult(/command)
> > > must specify an absolute path
> > >
> > > In any case, I suggest adding an ShellCommandExecResult function as it
> > > would be consistent with the existence of a ShellCommandReturnsZero
> > > functipon.
> > >
> > > Thank you,
> > > -Jason Martin
> > >
> > > > -----Original Message-----
> > > > From: Mark.Burgess@iu.hio.no [mailto:Mark.Burgess@iu.hio.no]
> > > > Sent: Tuesday, November 29, 2005 10:54 PM
> > > > To: Martin, Jason H
> > > > Cc: help-cfengine@gnu.org
> > > > Subject: Re: Pipes & ExecResult/ReturnsZero
> > > >
> > > >
> > > > > Is it expected that pipe characters will continue to work in
> > > > > ExecResult even though they no longer work in ReturnsZero?
> > > > ExecResult
> > > > > still honors pipe characters inside double-quotes, while
> > > > ReturnsZero
> > > > > only honors them inside single quotes.
> > > > >
> > > > > localdate = ( ExecResult(/bin/sh -c "/bin/date | grep 2005") )
> > > > >
> > > > > Whereas ReturnsZero requires opposite quoting to work with pipes
> > > > > properly:
> > > > > ResolvesX = ( ReturnsZero(/bin/sh -c 'nslookup "some.example.com"
> > > > > 2>&1
> > > > > | grep 169.254.1.1 >/dev/null') )
> > > > >
> > > > > It seems inconsistent to make these two functions require opposite
> > > > > quoting. Was this intended, or will there be a
> > > > ShellCommandExecResult
> > > > > in the future?
> > > > >
> > > > > Thank you,
> > > > > -Jason Martin
> > > > >
> > > > >
> > > >
> > > > The quopting is the same, but neither of the fnuctions uses a
> > > > shell. I made an ExecShellResult function for convenience. We
> > > > could do the same for RetrunsZero is necessary. The quoting I
> > > > recommend however (latest patchr
> > > > eleases) is to always have quotes around the shell string and
> > > > to backslash quptes inside them
> > > >
> > > > Func("/bin/sh -c \"my string\"")
> > > >
> > > > M
> > > >
> > > >
> >
> >
> >
> > _______________________________________________
> > Help-cfengine mailing list
> > Help-cfengine@gnu.org
> > http://lists.gnu.org/mailman/listinfo/help-cfengine
> >
> 
> 
> --
> Christian Pearce





reply via email to

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