help-cfengine
[Top][All Lists]
Advanced

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

Re: Strings with ':'


From: Chris (Ducky) Chapin
Subject: Re: Strings with ':'
Date: Tue, 17 Sep 2002 08:39:21 -0700 (PDT)

On Tue, 17 Sep 2002, Andrew Stribblehill wrote:

> > Besides, that doesn't answer the question: how do you
> > remove the meaning of the list separator character in
> > a string?
> 
> Not an answer for you but a suggestion for the future of cfengine...
> 
> If we had a function, say 'split', we could use:
> 
> mydirs = ( split(foo:bar:baz:quux) )

While elegant programatically, cfengine doesn't work like this. Splitting
happens when needed, so your "mydirs" variable stays as a strings until it
encounters a place where iteration is supported - which is during the
parsing of the conf.

This is why modules can't define a variable to be iterated over because by
the time the module is run, all the expansion opportunities occured during
the parsing phase.

I thought about suggesting a module to define David's var, but if modules
DO get the magic foo to allow interpolation, his conf would break in that
release.

David, try adding this line to your 'control:' stanza:

        split = ( "|" )   # Or another char that isn't used


-Ducky

--

 Christopher 'Ducky' Chapin                        ducky@qualcomm.com
 Unix Systems Administrator - Qualcomm, Inc.           (858) 651-5433
 IT Host Services - AE-209F                                 


> Unfortunately, this would break backward-compatibility, so maybe you
> could do with a literal() function instead. I reckon I could knock up
> a split() function but writing literal() would mean mucking around
> with more of cfengine's dark magic than I currently understand.







reply via email to

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