From ef17f2f0bb10d192b471d1a4b5e49e0b1b821cac Mon Sep 17 00:00:00 2001 From: Nick Anderson Date: Tue, 3 Feb 2026 03:12:50 -0600 Subject: [PATCH] Added documentation for this.calling bundle --- .../functions/callstack_callers.markdown | 2 +- .../reference/special-variables/this.markdown | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/content/reference/functions/callstack_callers.markdown b/content/reference/functions/callstack_callers.markdown index aa5bc2624..411c8057a 100644 --- a/content/reference/functions/callstack_callers.markdown +++ b/content/reference/functions/callstack_callers.markdown @@ -49,4 +49,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 e1c25b333..1bd662797 100644 --- a/content/reference/special-variables/this.markdown +++ b/content/reference/special-variables/this.markdown @@ -34,6 +34,44 @@ 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. + +**Note:** When `this.calling_bundle` is undefined it indicates that the bundle was actuated by the `bundlesequence` and not another bundle. + +**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