cfengine-develop
[Top][All Lists]
Advanced

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

Re: [Cfengine-develop] my own branch of the tree


From: Mark . Burgess
Subject: Re: [Cfengine-develop] my own branch of the tree
Date: Tue, 20 Jan 2004 17:56:18 +0100 (MET)

> I would probably do something that looked a
> heckuva lot like ruby, rather than perl:
> 
> control:
>       list = ( 1 2 3 4 )
> 
> copy:
>       ${list}.each { |item|
>               /path/to/files/${item} dest=/new/path/${item}
>       }
> 
> links:
>       ${list}.each { |item|
>               /usr/local/bin -> /usr/local/software/${item}/bin/*
>       }
> 
> I'm not saying that this is _the_ solution, but once you get used to it,
> it continues to make sense.



What would nested iteration look like in this scheme?


> Another option is to implicitly support iteration so that the syntax does
> not change at all:
> 
> control:
>       list = ( 1 2 3 4 )
> 
> copy:
>       /path/to/files/${list} dest=/new/path/${list}
> 
> links:
>       /new/place/${list} -> /old/place/${list}
> 
> I know links already kind of supports this, but it's using a standard
> string variable, not an actual list variable.  One of the real problems
> with this type of iteration is that you can't then do nested iterations,
> and you can't really do anything resembling hashes (associative arrays)
> either, and I think they're also important.

Cfengine does support nested iteration (see so-called 2d lists).
It is just not allowed on all variables.

It strikes me that one of the biggest problems in iteration is
what happens when there is nesting and how it should be evaluated.

Today, iteration lacks conceptual clarity in cfengine, but it does
work.

M

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Work: +47 22453272            Email:  address@hidden
Fax : +47 22453205            WWW  :  http://www.iu.hio.no/~mark
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





reply via email to

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