-
Type:
Bug
-
Status: Open
-
Priority:
High
-
Resolution: Unresolved
-
Affects Version/s: 3.9.1, 3.12.1, 3.15.0b1
-
Fix Version/s: None
-
Component/s: Evaluation, Language
-
Labels:None
-
Environment:Centos 7.2
Hello,
I have problems concerning the expansion of the special 'this' variable when it is used inside a parametrized body called from a bundle which is itself called from another bundle with a 'usebundle' directive.
To illustrate this, consider the autonomous testcase below:
body common control { bundlesequence => {"a"}; } bundle agent a { vars: "target_path" string => "/d1/d2/d3/my_file"; "used_bundles" slist => {"b", "c"}; files: "/tmp/a/d1/d2/d3/my_file" create => "true"; "/tmp/$(used_bundles)/d1/d2/d3/my_file" create => "true"; "$(target_path)" copy_from => my_copy_with_param("/tmp"); methods: "XXX" usebundle => $(used_bundles); } bundle agent b { files: "$(a.target_path)" copy_from => my_copy_without_param(); } bundle agent c { files: "$(a.target_path)" copy_from => my_copy_with_param("/tmp"); } body copy_from my_copy_without_param() { source => "/tmp/$(this.bundle)/$(this.promiser)"; servers => { "localhost" }; compare => "digest"; } body copy_from my_copy_with_param(root) { source => "/$(root)/$(this.bundle)/$(this.promiser)"; servers => { "localhost" }; compare => "digest"; }
The verbose logs are inside the attached file 'cf.log'.
To sum up, three cases are tested:
- I use the parametrized body my_copy_with_param directly in the main a bundle
- I use the unparametrized body my_copy_without_param wthin the b bundle called from the a bundle with a usebundle directive
- I use parametrized body my_copy_with_param wthin the c bundle called from the a bundle with a usebundle directive
In the two bodies i use the variables this.bundle and this.promiser.
The two first cases are OK, the 'this' variable is correctly expanded as the calling bundle (a in the first case, b in the second case).
In the third case, the 'this' variable is not corrctly expanded, as it references the a bundle (the root bundle) whereas it should reference the c bundle, as it is the calling bundle. Il seems that the body parameter muddles in certain way the 'this' variable.
This bug, if it appears to be one, is potentially very harmful as a bundle (the c bundle in this case) never knows the context of its activation, directly in the bundlesequence or indirectly via a usebundle directive.
- relates to
-
CFE-3176 $(this.promiser) is not expanded correctly in a copy_from body
-
- Rejected
-