execute statement in match clause
Yves-Alexis Perez
corsac at debian.org
Wed Jul 2 16:26:48 UTC 2008
On Wed, Jul 02, 2008 at 04:15:33PM +0000, Evan Hunt wrote:
> Nope. IIRC, one of the 3.1.0 alphas had a version of the code
> in which execute() was boolean, but that meant you had to use
> expr(execute("blah")) to run anything. Also, it wasn't obvious
> what boolean value should be returned: true if execution was
> successful, or true if return code is zero? So we punted.
Well, as I didn't know execute() I wanted to try it to make sure an
identifier is in the database before allocating it an IP. As I
understand it, execute() is (for now) intended, for example, to log
stuff in an external base or something like that, you can't use the
value it return.
Anyway, it could be nice to use it as a numeric expression, using the
return value. Well, in fact, that was how I thought it worked, and
wanted to do stuff like:
class "example" {
match if execute("/usr/bin/grep", option dhcp-client-identifier,/etc/dhcp3/database) = 1;
}
Or run any script which would return some value if the identifier is
found in the database.
Cheers,
--
Yves-Alexis
More information about the dhcp-users
mailing list