Forum: CFEngine Help Subject: Re: can't find defined bundle Author: zzamboni Link to topic: https://cfengine.com/forum/read.php?3,24359,24360#msg-24360
Carl, Your sample policy is ridden with errors. Some noticeable ones: - "Pretty" quotes - not sure if this is the result of copy-and-paste or you typed the policy in some editor that does conversion. They need to be plain ASCII quotes. - Missing semicolons at the end of several statements. - Declaration of "dir_list" inside a files: section, needs to be inside a vars: section. - String in reports: is not inside quotes. I would suggest reading through the documentation on agent structure, files: promises, and file_select in particular. In the meantime, I think what you want is something like this: #!/usr/local/sbin/cf-agent -f body common control { inputs => { "cfengine_stdlib.cf" }; bundlesequence => { "invalidfiles" }; version => "1.0.0"; } 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, depth_search => recurse("inf"); } When run it gives: $ cf-agent -K -f ./t.cf Please delete /tmp/foo.core If you comment out the "transformer" line and uncomment the "delete" line, it will remove the files itself: $ cf-agent -KI -f ./t.cf -> Deleted file /tmp/foo.core Hope this helps. _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine