Сева Глущенко <seva.glusche...@gmail.com> écrit :
> 
> at the first glance it looks like getting installed packages can be
> simplified a bit:
> 
> bundle agent packages
> {
>  vars:
>     "pkg_list"  string => execresult("/usr/bin/dpkg -l | /usr/bin/awk
> '/^ii/ {print $2}'", "useshell");
>     "installed" string => splitstring("$(pkg_list)", "[\n]" , "10000");
> ...

I was thinking about that but I couldn't find how to remove
elements from a list.  That's why I used a temporary file instead
(I know this is not optimal):

> > files:
> >        "/tmp/installed"
> >                edit_line       => delete_lines_matching ( "$(packages)" ) ;

> The idea of crossing promises that way looks dubious, but if cfengine
> handles that correctly - well, okay...

As the documentation states (page 26) :

2. Within a bundle, the promise types are executed in a
round-robin fashion according to so-called `normal ordering'
(essentially deletion first followed by creation). The actual
sequence continues for up to three iterations of the following:
[...]

So I believe it's OK.

-- 
Marc Baudoin
STG Interactive
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to