Another approach would be: 

"exists" expression  => filesexist("@(filelist)");

See: 
http://www.cfengine.org/manuals/cf3-reference.html#Function-filesexist

Bernd Adamowicz | R&D BasisTechnology
Tel.: +49 (0) 6227 385 332 82 | Fax: +49 (0) 6227 385 588
bernd.adamow...@external.icw-global.com | www.icw.de | www.lifesensor.com







From:
Nicolas Charles <charl...@gmail.com>
To:
help-cfengine@cfengine.org
Date:
11.12.2009 11:56
Subject:
Re: Search a file in different locations
Sent by:
help-cfengine-boun...@cfengine.org



Hi,

You could try using a list a files :
vars:
"filelist" slist => {"/a/foo", "/b/foo", "/c/foo"};

classes:
"exists" expression  => fileexists($(filelist));

Regards,
Nicolas

On Fri, Dec 11, 2009 at 11:39 AM, Matthias Teege <matthias-...@mteege.de> 
wrote:
Moin,

I can set a class based on the existence of a file with fileexists. But
sometimes I have to set a class if a file exists in directory "/a" or
"/b" or "/c". I can use something like this:

"exists_in_a" expression  => fileexists("/a/foo");
"exists_in_b" expression  => fileexists("/b/foo");
"exists_in_c" expression  => fileexists("/c/foo");
"exists" or  => { "exists_in_a","exists_in_b","exists_in_c" };

Is there a more "elegant" way to check for a file?

Many thanks
Matthias

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




InterComponentWare AG:  
Vorstand: Dr. Lutz Kleinholz (Vors.), Dr. Georg Ralle, Jörg Stadler / 
Aufsichtsratsvors.: Prof. Dr. Christof Hettich  
Firmensitz: 69190 Walldorf, Industriestraße 41 / AG Mannheim HRB 351761 / 
USt.-IdNr.: DE 198388516  
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to