Forum: CFEngine Help
Subject: Re: classnames constructed with "$(foo)": how to canonify in "common"?
Author: zzamboni
Link to topic: https://cfengine.com/forum/read.php?3,27082,27089#msg-27089
David,
I cannot reproduce this behavior. Here is my test policy, based on the code you
posted, and which I tested with 3.3.4 under Darwin:
body common control
{
bundlesequence => { "testbundle" };
}
bundle common testbundle
{
vars:
"list" slist => { "one", "two", "three", "/weird/", };
"c_list[$(list)]" string => canonify("$(list)");
classes:
"g_exists_$(list)" expression => "any";
"g_c_exists_$(c_list[$(list)])" expression => "any";
reports:
cfengine::
"g_exists_$(list) is defined"
ifvarclass => canonify("g_exists_$(list)");
"g_c_exists_$(c_list[$(list)]) is defined"
ifvarclass => "g_c_exists_$(c_list[$(list)])";
}
And here is the output:
R: g_exists_one is defined
R: g_exists_two is defined
R: g_exists_three is defined
R: g_exists_/weird/ is defined
R: g_c_exists_one is defined
R: g_c_exists_two is defined
R: g_c_exists_three is defined
R: g_c_exists__weird_ is defined
Note that I had to add canonify() around the ifvarclass value when using plain
$(list), because ifvarclass does not automatically canonify its argument. But
other than that, the policy behaves as expected. I also don't see any strange
messages in the -v output.
I wonder if there could be something else in your policy that is causing this -
could you post a complete, self-contained example that exhibits the problem you
describe?
Thanks,
--Diego
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine