If a system may or may not have a specific file and you only want to
evaluate the promise if the file exists, this is an example of the only
way I can see to do that:

classes:

    "file_exists" expression => fileexists("/var/adm/kern.info");

files:

    file_exists::

        "/var/adm/kern.info"

            rename => rotate("5");

I was thinking that it might be nice to have something like an
"optional" attribute that would ignore the promise if the file doesn't
exist (maybe defaulting to "false"), simplifying such promises:

files:

    "/var/adm/kern.info"

        optional => "true",
          rename => rotate("5");

Has anyone else thought about this or know of something that I might be
missing? I'm setting up some log rotation (hence this particular
example) and currently we have a number of such "optional" log files on
many systems (but we're working on cleaning that up).

Thanks,
Justin

-- 
Justin C. Lloyd 
Unix Infrastructure Engineer 
DigitalGlobe, An Imaging and Information Company


This electronic communication and any attachments may contain confidential and 
proprietary 
information of DigitalGlobe, Inc. If you are not the intended recipient, or an 
agent or employee 
responsible for delivering this communication to the intended recipient, or if 
you have received 
this communication in error, please do not print, copy, retransmit, disseminate 
or 
otherwise use the information. Please indicate to the sender that you have 
received this 
communication in error, and delete the copy you received. DigitalGlobe reserves 
the 
right to monitor any electronic communication sent or received by its 
employees, agents 
or representatives.

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

Reply via email to