diff --git a/content/reference/functions/callstack_callers.markdown b/content/reference/functions/callstack_callers.markdown index b716139cd..e99cd0c3f 100644 --- a/content/reference/functions/callstack_callers.markdown +++ b/content/reference/functions/callstack_callers.markdown @@ -51,4 +51,4 @@ Output: **History:** Introduced in CFEngine 3.9 -**See also:** `callstack_promisers()` +**See also:** `callstack_promisers()`, `this.calling_bundle` diff --git a/content/reference/special-variables/this.markdown b/content/reference/special-variables/this.markdown index 747173e8b..59ff8ff15 100644 --- a/content/reference/special-variables/this.markdown +++ b/content/reference/special-variables/this.markdown @@ -36,6 +36,42 @@ declared). This variable contains the current bundle name. +### this.calling_bundle + +This variable contains the name of the bundle from which the current bundle was called. + +**Example:** + +```cf3 {file="example-this_calling_bundle.cf"} +bundle agent main +{ + methods: + "two"; + + reports: + "in bundle $(this.bundle), caller $(with)" + with => ifelse( isvariable( "this.calling_bundle" ), "$(this.calling_bundle)", + "bundlesequence" ); +} + +bundle agent two +{ + reports: + "in bundle $(this.bundle), caller $(with)" + with => ifelse( isvariable( "this.calling_bundle" ), "$(this.calling_bundle)", + "bundlesequence" ); +} +``` + +```output +R: in bundle two, caller default:main +R: in bundle main, caller bundlesequence +``` + +**History:** + +- Added in CFEngine 3.27.0 + ### this.handle This variable points to the promise handle of the currently handled