[Top][All Lists]

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

Re: 2.1.17 having issue with ExecResult() using pipelines

From: Paul Krizak
Subject: Re: 2.1.17 having issue with ExecResult() using pipelines
Date: Fri, 11 Nov 2005 15:13:54 -0600
User-agent: Mozilla Thunderbird 1.0.7 (X11/20050923)

What was preventing the pipes from working in ExecResult? I'm a bit concerned that it was reportedly working in 2.1.15 (which is the version we're on now), and apparently broken in 2.1.16-17...and then fixed with a *new* command in 2.1.18cvs?

I'm not sure how running

ExecResult(/bin/sh -c ${dblquote}/bin/cat /proc/cpuinfo | grep Processor${dblquote})

Is any different than

ExecShellresult(/bin/cat /proc/cpuinfo | grep Processor)

...or am I missing something?

Paul Krizak                         5900 E. Ben White Blvd. MS 625
Advanced Micro Devices              Austin, TX  78741
Linux/Unix Systems Engineering      Phone: (512) 602-8775
Microprocessor Solutions Sector

Mark Burgess wrote:
For your delectition I have arranged for a patch


which will work just like ExecResult but use a shell, so that your pipes
will work now. You can get it from the svn server right now. Snapshot in
a few mins


On Fri, 2005-11-11 at 15:24 -0500, nathan r. hruby wrote:

On Fri, 11 Nov 2005, Chip Seraphine wrote:

nathan r. hruby wrote:

On Fri, 11 Nov 2005, Martin, Jason H wrote:

If yada isn't in the normal path then that might be a problem; I don't
know what PATH will be set to when that happens. Good point.

Err.. right: here's the full real command:
CurrentLoad = ( ExecResult(/bin/sh -c "/bin/cat /proc/loadavg | /bin/awk '{print $1}' | tr -d '\n'") )

What I'm seeing in 2.1.17 is that everything after "/bin/cat" simply
dissapears and thus no pipeline.  eg, run a ps -ef while this is runnning
and the awk and tr are not being executed.  The above works in 2.1.14.

I've had similar problems (starting in 2.1.16, I think). I've been able to workaround it by switching the order of quote nesting; in other words:

Yeah, I see that now

thisworks= ( ExecResult(/bin/sh -c 'command1 "quotedarg" | command2') )


thisnoworks= ( ExecResult(/bin/sh -c "command1 'quotedarg' | command2") )

In cases where I really neeed single quotes on the inside (as you do in your awk call), I've generally just punted and written little shell scripts for cfengine to call. I could probably kludge it with special variables, but it gets nearly unreadable quickly.

Sigh.  Neither are good solutions.  I have a lot of these little pipelines,
all culled from the little shell scripts I'm trying to get rid of so it
looks like the kludgy special variable it is.. Which doesn't seem to work

Oh hell.


Help-cfengine mailing list

reply via email to

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