Ah, that sounds like a bug/unanticipated issue. Please file a report. Sorry. 
Sounds like my fault. 
-- 
Sent from my Android phone with probably ridiculous and involuntary spelling 
corrections.

Riccardo Murri <riccardo.mu...@uzh.ch> wrote:

Hello,

I'm trying to use `edit_template` to generate a configuration file
from a bundle; however, conditionals based on classes defined in the
bundle are apparently ignored (i.e., the class expression evaluates to
"!any").

I guess that CFEngine does not export bundle-local classes to the
templating engine (although it's in the same bundle). Is there a way
to accomplish this?

I'm using the community edition, v3.3.4.

Thanks for any help!

Riccardo

## Example .cf:

bundle agent test(flag) {
vars:
"templatefile" string => "$(sys.workdir)/masterfiles/test.tmpl";

classes:
"local_class" expression => strcmp("$(flag)", "true");

files:
"/tmp/test"
create => "true",
edit_defaults => empty,
edit_template => "$(templatefile)";
}

bundle agent main {
methods:
"test" usebundle => test("true");
}

## Template file:

[%CFEngine local_class:: %]
This part is always removed.

[%CFEngine Hr14:: %]
It's 2 o'clock.
(This part appears at the right time.)
_____________________________________________

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

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

Reply via email to