From ff02373e2a0c487eedd1c3e05dfd86758fe71651 Mon Sep 17 00:00:00 2001 From: Nick Anderson Date: Tue, 9 Sep 2025 12:38:58 -0500 Subject: [PATCH] Fixed duplicate bundlesequence_end when bundlesequence_classification not defined Ticket: CFE-4588 Changelog: Title --- controls/def.cf | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/controls/def.cf b/controls/def.cf index bd890a3a71..c162fd06c9 100644 --- a/controls/def.cf +++ b/controls/def.cf @@ -278,15 +278,33 @@ bundle common def # Common Controls # Because in some versions of cfengine bundlesequence in body common - # control does not support does not support iteration over data containers - # we must first pick out the bundles into a shallow container that we can - # then get a regular list from using getvalues(). + # control does not support iteration over data containers we must first + # pick out the bundles into a shallow container that we can then get a + # regular list from using getvalues(). - "tbse" data => mergedata( "def.control_common_bundlesequence_end" ); - "bundlesequence_end" slist => getvalues( tbse ); - - "tbse" data => mergedata( "def.control_common_bundlesequence_classification" ); - "bundlesequence_classification" slist => getvalues( tbse ); + "bundlesequence_end" -> { "CFE-4855" } + slist => { }, + if => not( isvariable( "def.control_common_bundlesequence_end") ), + comment => concat( "We define an empty list so that the agent will not", + " error about undefined variable when ", + " def.bundlesequence_end is not defined." ); + "bundlesequence_end" -> { "CFE-4855" } + slist => getvalues( mergedata( "def.control_common_bundlesequence_end" ) ), + comment => concat( "We define bundlesequence_end from Augments if it's", + " available. This allows for customization without", + " modifying the vendored policy." ); + + "bundlesequence_classification" -> { "CFE-4855" } + slist => { }, + if => not( isvariable( "def.control_common_bundlesequence_classification") ), + comment => concat( "We define an empty list so that the agent will not", + " error about undefined variable when ", + " def.bundlesequence_classification is not defined." ); + "bundlesequence_classification" -> { "CFE-4855" } + slist => getvalues( mergedata( "def.control_common_bundlesequence_classification" ) ), + comment => concat( "We define bundlesequence_classification from Augments if it's", + " available. This allows for customization without", + " modifying the vendored policy." ); "control_common_ignore_missing_bundles" -> { "CFE-2773" } string => ifelse( strcmp( $(control_common_ignore_missing_bundles), "true" ),