This is the root of the problem:
file_select implies a search - and the only way you can have a search is
either with depth_search or a wildcard in the filename
I believe this is also a bug, in that Cfengine should tell you when you have
a promise that cannot be satisfied, and requires a component that you have
ommitted.
Something very similar to this was reported in the bug tracking system with
ID 0000037, and repaired 2010-03-19 - so I have to ask if you are running
the latest version of Cfengine?
-Dan
> Then, you should do something like the following; changing the promiser to a
> parent directory and using file_select to match the file name. Haven't test b
> ut it should work. :-)
>
> files:
> "/var/cfengine"
> file_select => size_exceeds("promise\.log","1M"),
> depth_search => recurse("1"),
> rename => rotate("2");
>
> body file_select size_exceeds(filename,filesize)
> {
> leaf_name => { "$(filename)" };
> search_size => irange("$(filesize)","10M");
> file_result => "leaf_name.size";
> }
>
> Cheers,
> --Nakarin
>
> On Jun 4, 2010, at 9:38 AM, Seva Gluschenko wrote:
>
> > Nakarin,
> >
> > this way you can only define timed rotation (by means of action =>
> > if_elapsed or by classes), but not size-based rotation. To define
> > size-based rotation, I use file_select, but it wants depth_search from
> > me. I believe, depth_search requirement must be suppressed for file
> > promises.
> >
> > 2010/6/4 Nakarin Phooripoom <[email protected]>:
> >> Do we really need to include depth_search to rotate a file?
> >>
> >> file:
> >> "/var/cfengine/promise.log"
> >> rename => rotate("3");
> >>
> >> Cheers,
> >> --Nakarin
> >>
> >> On Jun 4, 2010, at 8:46 AM, Seva Gluschenko wrote:
> >>
> >>> Hello folks,
> >>>
> >>> When I wrote a promise to rotate /var/cfengine/promise.log (BTW, why
> >>> Cfengine doesn't rotate it?), cf-promises warned me about using rename
> >>> body without depth_search body. Well, okay, despite I was surprised
> >>> with such a requirement, I've added depth_search => recursion("1").
> >>> Now (with 3.0.5b2), executor sends me messages with the following
> >>> warning:
> >>>
> >>> Warning: depth_search (recursion) is promised for a base object
> >>> /var/cfengine/promise.log that is not a directory
> >>>
> >>> So how do I get rid of warnings? Can depth_search be removed now or so?
> >>>
> >>> --
> >>> SY, Seva Gluschenko.
> >>> _______________________________________________
> >>> Help-cfengine mailing list
> >>> [email protected]
> >>> https://cfengine.org/mailman/listinfo/help-cfengine
> >>
> >>
> >
> >
> >
> > --
> > SY, Seva Gluschenko.
>
> _______________________________________________
> Help-cfengine mailing list
> [email protected]
> https://cfengine.org/mailman/listinfo/help-cfengine
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine