help-cfengine
[Top][All Lists]
Advanced

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

Re: Switching off a shellcommand with empty list variable


From: David Baird
Subject: Re: Switching off a shellcommand with empty list variable
Date: Fri, 21 Jan 2005 20:10:16 +0000
User-agent: Mozilla Thunderbird 0.9 (Windows/20041103)

Joe Moore wrote:
David Baird wrote:

control:
    missing_ports = ( ExecResult(/usr/bin/perl -e blah) )

shellcommands:

  "/usr/local/sbin/portupgrade --new $(missing_ports)"


The perl one-liner returns a colon-separated list of ports that need to be installed. The problem is that if there are no missing ports, the shellcommand still gets called. Is there any way I can set a class if $(missing_ports) is empty?

Perhaps

shellcommands:
"[ -n '$(missing_ports)' ] && /usr/local/sbin/portupgrade --new $(missing_ports)"

--Joe


Thanks! That helps, except that cfengine requires shellcommands to start with absolute file paths. Should work if I stick a dummy command like /bin/sleep 0 at the start.

d.




reply via email to

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