Forum: CFEngine Help
Subject: Re: can't find defined bundle
Author: zzamboni
Link to topic: https://cfengine.com/forum/read.php?3,24359,24362#msg-24362

I don't think there is a way to produce a list with all the files that were 
matched by a promise with a file_select attribute. file_result is not a 
variable you can expand, it's used in the file_select body to indicate the 
boolean expression to use when matching files.

To produce a list of files to delete without using a transformer, you could use 
the warn_only action policy:


bundle agent invalidfiles
{
  vars:
      "dir_list" slist => { "/tmp/", "/etc/" };
  files:
      "$(dir_list)"
        file_select => by_name(".*\.core"),
#        transformer => "/bin/echo Please delete $(this.promiser)",
        delete => tidy,
        action => warn_only,
        depth_search => recurse("inf");
}


However, I should ask why you want CFEngine to just warn you about something? 
CFEngine is best when it can remediate problems itself. If your ultimate 
objective is to remove those files, you should just have CFEngine do it.

Side note: you do not have to define the "ok" class to use in the reports: 
section. You could use any other class that is always defined, such as 
"cfengine".

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

Reply via email to