cfengine-develop
[Top][All Lists]
Advanced

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

Re: [Cfengine-develop] Patch for supporting lists in variable/function a


From: Luke A. Kanies
Subject: Re: [Cfengine-develop] Patch for supporting lists in variable/function assignments
Date: Wed, 3 Dec 2003 08:18:15 -0600 (CST)

On Wed, 3 Dec 2003 address@hidden wrote:

>
> THanks - will take a while to look at these patches, but as I said
> a while back, we need to have a real and informed discussion about
> iteration. I suggest including Alva and Paul in it. We need to find
> a general syntax for it that does not do violence to the cfengine
> simplicity.
>
> Last time I asked, I remember you sending me lots of Perl - but
> that's not the answer. We need something really smart.

Well, this definitely isn't perl.

This isn't even iteration, really.  I just copied the AddMultipleClasses
function and modified it a bit; all this does is take, for instance, the
results of ExecResult and split it based on ' ,', so I can call an
external function to fill in more than one value.  This is what I want to
support:

AllowConnectionsFrom = ( ExecResult(/get/hosts/from/ldap) )

In current versions of cfengine, this would try to set

'192.168.0.1 192.168.0.2 192.168.0.3'

as a single IP address, which would cause a fatal error later on.  What
this patch does is split that string based on spaces, so that you get the
equivalent of:

AllowConnectionsFrom = ( 192.168.0.1 192.168.0.2 192.168.0.3 )

That's all.  Not iteration at all, since cfengine isn't doing any looping.
All it's doing is allowing me to add more than one item at a time to
cfengine's builtin "variables".

Luke

-- 
Your civilization has built the Internet.(+2sci) This obsoletes the
Hollywood wonder.(+1hap) --Odinson




reply via email to

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