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: Atom Powers
Subject: RE: Switching off a shellcommand with empty list variable
Date: Fri, 21 Jan 2005 11:02:43 -0800

Better way, modify the script that returns the colon-separated list to exit 1
if there are no ports and 0 if there are ports. Check the reference, but you
may be able to do something like this:

Classes:
        portupgrade = ReturnsZero(<port-finder-script>)

Shellcommands:
        portupgrade::
                "/usr/local/sbin/portupgrade $(missing_ports)"

Or if cfengine leaves a variable undefined if they are empty you could do
this
Classes:
        portupgrade = IsDefined(missing_ports)

----
Perfection is just a word I use occasionally with mustard.

Atom Powers
Systems Administrator
Pyramid Breweries Inc.
206.682.8322 x251
-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
Jeremy Mates
Sent: Friday, January 21, 2005 10:24 AM
To: address@hidden
Subject: Re: Switching off a shellcommand with empty list variable

* David Baird <address@hidden>
> 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 wrap portupgrade and abort if the arguments list is empty?

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


  #!/bin/sh
  [ -z "$1" ] && exit
  exec /usr/local/sbin/portupgrade $@

-- 
Jeremy Mates                     (206) 22 1-4714
Systems Administrator            K 324, Health Sciences Center
http://cfm.gs.washington.edu/    Mail Box 357730


_______________________________________________
Help-cfengine mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-cfengine





reply via email to

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