On Fri, 15 Jun 2012 21:39:46 +0200 (CEST) sauer wrote: 

n> So, I have a couple of situations where I want to populate an exclude
n> list from an external file.  For example, I want to remove the
n> suid/sgid bits from executable files which are group or
n> world-writeable, unless the file is in an approved list.  I'd like to
n> maintain the file in an external file formatted like

n> class:filename

n> I only want "filename" to be an excluded file if the class is a class
n> which is set on the current system.  What I'm currently thinking is
n> that I could read the whole file into an array like array = class,
n> make an slist of all the elements in array, then make a second array
n> like

n> "skipfiles[$(files)]" string => $(files), ifvarclass => allfiles[$(files)]

...

n> I don't know.  I'd appreciate any input on solutions to this problem,
n> including completely different directions. :) Maybe I should have a
n> scond promise to make a copy of the first file which only contains
n> lines that match currently-defined classes?  I'm not sure exactly how
n> I'd do that, either... :)

This is a hard problem for thousands of entries, as you suggested.  I
know of another use case where the customer wants to write templates
that look like your example, except it's "class: content" so you only
want the content that matches your class.  A cfengine context syntax
parser is very easy to write so the customer chose to write their own
filter in Perl.  I think it makes sense to treat this as a templating
problem and provide support for it in the template language, but that's
just my opinion...  I can write a Perl-based filter, if that will help
you.

Ted
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to