Re: classfiltercsv: filtering only works on bundle level
Nick Anderson <[email protected]>
| Newsgroups | gmane.comp.sysutils.cfengine.general |
|---|---|
| Message-ID | <[email protected]> |
Why is this not in my inbox?
On Thursday, October 14, 2021 at 3:02:00 AM UTC-5 Xander Cage wrote:
>
> seems that the classes filter only works if the data and filter classes
> are in the same bundle. i want to use the data container as a somewhat
> "global" variable without repeating it in any bundle that uses it.
>
> for example:
>
> bundle agent parent_bundle
> {
> classes:
>
> #"weirdos";
> #"twats";
> #"zombie";
> #"amlinz";
>
> vars:
> "data_file" string => "/root/cfe_testbed/users.csv";
> "d" data => classfiltercsv($(data_file), "true", 0);
>
> "keys_unsorted" slist => getindices("d");
> "keys" slist => sort(keys_unsorted, "lex");
>
> #"users_$(keys)" data => mergedata("d[$(keys)]");
>
>
> methods:
>
> "call_child" usebundle => child_bundle(@(d), $(keys)),
> handle => "remove_it";
>
>
> }
>
> bundle agent child_bundle (info, idx) {
>
> classes:
>
> # filtering class to get only the relevant data for this bundle,
> seems the natural way #to do it,
> # but does not work
> "zombie";
>
> vars:
>
> "names" slist => getvalues("info[$(idx)][name]");
> "names_str" string => format("%S", names);
>
> methods:
>
> "call_check_user" usebundle => check_user("$(names_str)");
> }
>
--
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 [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/help-cfengine/9353a3d4-c583-497d-80fe-72ea49cc510dn%40googlegroups.com.