Problems while upgrading to latest cfengine-community LTS

Berthold Cogel <[email protected]> Tue, 21 Oct 2025 13:57:30 +0200
Newsgroups gmane.comp.sysutils.cfengine.general
Message-ID <[email protected]>
Hello,

we have a script that updates all our modules after the master files 
have been updated. This script is designed to transfer changes to the 
modules, add new modules to a host, and delete those that are no longer 
needed. The script compares the installed modules with the expected 
modules for the host.

Problem:

A change in the behavior of the latest version now causes all modules to 
be deleted.

The script works up to and including version 3.23.0. The problem occurs 
when upgrading to 3.24.0 and it also exists in 3.24.2.

The relevant part of the script appears to be this one:

------:<----------------

bundle agent controller {
       # Delete everything not in module list.
   vars:
       "dirs_found"     slist => findfiles("$(constants.conf_dir)/*/");
       "dirs_expected"  slist => { 
maplist("$(constants.conf_dir)/$(this)/", @(constants.module_list)), 
"$(constants.conf_dir)/host_config/" };
       "dirs_to_delete" slist => difference(dirs_found, dirs_expected);
   methods:
       "any" usebundle => rm_rf("$(dirs_to_delete)");

   methods:
       # sync the modules
     !debugflag_mode::
       "any" usebundle => host_config;
       "any" usebundle => sync_module($(constants.module_list));

   reports:
     inform_mode::
       "Deleted directory '$(dirs_to_delete)' because it is not in 
constants.module_list";
     inform_mode.!debugflag_mode::
       "controller was activated";
     inform_mode.debugflag_mode::
       "controller is deactivated";
}

------:<----------------

Debug output of working version:

  verbose: V:     Computing value of 'dirs_found'
    debug: Evaluating vars promise: dirs_found
    debug: V: 'dirs_found' => '/var/cfengine/config/host_config/, ......'
    debug: Evaluating vars promise: dirs_found
    debug: DeRefCopyPromise(): promiser:'dirs_expected'
    debug: DeRefCopyPromise():     copying constraint: 'slist'
    debug: Evaluating function: 
maplist("/var/cfengine/config/$(this)/","@(constants.module_list)")
  verbose: V:     Computing value of 'dirs_expected'
    debug: Evaluating vars promise: dirs_expected
    debug: V: 'dirs_expected' => '/var/cfengine/config/afs/, ......'
    debug: Evaluating vars promise: dirs_expected
    debug: DeRefCopyPromise(): promiser:'dirs_to_delete'
    debug: DeRefCopyPromise():     copying constraint: 'slist'
    debug: Evaluating function: difference("dirs_found","dirs_expected")
  verbose: V:     Computing value of 'dirs_to_delete'
    debug: Evaluating vars promise: dirs_to_delete
    debug: V: 'dirs_to_delete' => ''
    debug: Evaluating vars promise: dirs_to_delete
    debug: DeRefCopyPromise(): promiser:'any'
    debug: DeRefCopyPromise():     copying constraint: 'usebundle'
    debug: Starting iteration engine with 1 wheels   ---   ENTERING WARP 
SPEED
  verbose: Skipping iteration since variable 'dirs_to_delete' resolves 
to an empty list
    debug: Iteration engine finished   ---   WARPING OUT

.....

Debug output of failing version:

verbose: V:     Computing value of 'dirs_found'
    debug: Evaluating vars promise: dirs_found
    debug: V: 'dirs_found' => '/var/cfengine/config/krb, ......'
    debug: Evaluating vars promise: dirs_found
    debug: DeRefCopyPromise(): promiser:'dirs_expected'
    debug: DeRefCopyPromise():     copying constraint: 'slist'
    debug: Evaluating function: 
maplist("/var/cfengine/config/$(this)/","@(constants.module_list)")
  verbose: V:     Computing value of 'dirs_expected'
    debug: Evaluating vars promise: dirs_expected
    debug: V: 'dirs_expected' => '/var/cfengine/config/afs/, ......'
    debug: Evaluating vars promise: dirs_expected
    debug: DeRefCopyPromise(): promiser:'dirs_to_delete'
    debug: DeRefCopyPromise():     copying constraint: 'slist'
    debug: Evaluating function: difference("dirs_found","dirs_expected")
  verbose: V:     Computing value of 'dirs_to_delete'
    debug: Evaluating vars promise: dirs_to_delete
    debug: V: 'dirs_to_delete' => '/var/cfengine/config/krb, ......'
    debug: Evaluating vars promise: dirs_to_delete
    debug: DeRefCopyPromise(): promiser:'any'
    debug: DeRefCopyPromise():     copying constraint: 'usebundle'
    debug: Starting iteration engine with 1 wheels   ---   ENTERING WARP 
SPEED
  verbose: P: .........................................................
  verbose: P: BEGIN promise 'promise_user_update_lib_cf_8' of type 
"methods" (pass 1)
  verbose: P:    Promiser/affected object: 'any'
  verbose: P:    Part of bundle: controller
  verbose: P:    Base context class: any
  verbose: P:    Stack path: /default/controller/methods/'any'[1]
  verbose: B: 
*****************************************************************
  verbose: B: BEGIN bundle rm_rf( {"/var/cfengine/config/krb"})
  verbose: B: 
*****************************************************************

......



The problem seems to be the difference function.


Regards
Berthold Cogel







-- 
You received this message because you are subscribed to the Google Groups "help-cfengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/help-cfengine/9bf5808d-aaca-4bd3-a278-6f52b08149d1%40uni-koeln.de.