--
You received this message because you are subscribed to the Google Groups "help-cfengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to help-cfengine+unsubscribe@googlegroups.com.
To post to this group, send email to help-c...@googlegroups.com.
Visit this group at https://groups.google.com/group/help-cfengine.
For more options, visit https://groups.google.com/d/optout.
Jeroen van den Haspel <jvdh...@gmail.com> writes:
> All,
>
> When doing something like:
> files:
>
> "{perms2use}","{group2use}"),
> action => immediatedlc,
> copyfrom => cpdlc("${source}/"),
> depthsearch => recurse("1"),
> classes => ifrepaired("statusfilescopy");
>
> The class statusfilescopy will always be set. Even if the files are
> already there and nothing is copied.
>
> Any idea how to deal with that?
I really prefer to use the results
classes body because it gives me classes
for each outcome a promise has, and because I can scope the classes to the
bundle instead of namespace scoped where the classes can be seen by other
bundles.
For example:
bundle agent main { commands: "/bin/true" classes => results("bundle", "true"); vars: "found_classes" slist => classesmatching("true_.*"); reports: "CFEngine $(sys.cf_version)"; "Found class '$(found_classes)'"; }
R: CFEngine 3.10.1 R: Found class 'true_repaired' R: Found class 'true_reached'
And when iterating over a list, you can define classes for each iterable.
bundle agent main { vars: "l" slist => { "one", "two", "three" }; commands: "/bin/echo $(l)" classes => results("bundle", "echo_$(l)" ); "/bin/false $(l)" classes => results("bundle", "false_$(l)" ); vars: "found_classes" slist => classesmatching("(echo|false).*"); reports: "CFEngine $(sys.cf_version)"; "Found class '$(found_classes)'"; }
notice: Q: ".../bin/echo one": one notice: Q: ".../bin/echo two": two notice: Q: ".../bin/echo three": three error: Finished command related to promiser '/bin/false one' -- an error occurred, returned 1 error: Finished command related to promiser '/bin/false two' -- an error occurred, returned 1 error: Finished command related to promiser '/bin/false three' -- an error occurred, returned 1 R: CFEngine 3.10.1 R: Found class 'false_two_reached' R: Found class 'echo_two_repaired' R: Found class 'false_three_error' R: Found class 'false_one_reached' R: Found class 'false_two_error' R: Found class 'false_one_error' R: Found class 'false_two_failed' R: Found class 'false_two_not_kept' R: Found class 'false_one_failed' R: Found class 'false_one_not_kept' R: Found class 'echo_one_reached' R: Found class 'false_three_reached' R: Found class 'echo_one_repaired' R: Found class 'echo_two_reached' R: Found class 'echo_three_repaired' R: Found class 'false_three_not_kept' R: Found class 'echo_three_reached' R: Found class 'false_three_failed'
Hope this helps.
–
Nick Anderson
Doer of things, CFEngine
--
You received this message because you are subscribed to a topic in the Google Groups "help-cfengine" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/help-cfengine/nMvf79L-pXY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to help-cfengine+unsubscribe@googlegroups.com.
Jeroen van den Haspel <jvdh...@gmail.com> writes:
> That's indeed similar to what I do:
> prefixok.!prefixchanged.!prefixerror::
>
> Is it possible to do prefixkept.!(prefixrepaired|prefixerror) within a
> body class?
> So the outcome gives a "real" "unchanged" status?
No, there is no way to do that inside the classes body.
process_select
bodies have process_result
and file_select
bodies have the
file_result
which allows you to construct an expression to describe the
characteristic of a process or file that should match.