Re: mpf_update_policy_bundle: can this be a list?

"[email protected]" <[email protected]> Fri, 23 Jun 2023 07:47:14 -0700 (PDT)
Newsgroups gmane.comp.sysutils.cfengine.general
Message-ID <[email protected]>
Thanks, Nick.  That's most useful.

Yesterday I sketched the idea (that I had suspected I might need, and you 
confirmed) of "def.json" specifying a "super bundle" calling my functional 
bundles (our pre-existing "policy_channels" and my new functionality), and 
it seems to be working fine, calling both of them.  (On test machines I was 
able flip them back and forth several times (exercising "policy_channels" 
which now resumes working!) and also seeing it exercise the "before" and 
"after" of my new functionality.

-- David Lee

On Thursday, 22 June 2023 at 17:35:53 UTC+1 [email protected] wrote:

> Is it a design feature that "mpf_update_policy_bundle" can only specify a 
> single bundle? Or perhaps a bug? 
>
> (I can probably do a work-around of a single, higher-level bundle which 
> itself then calls both my intended real bundles. But still…) 
>
> It's by design that it's a single bundle. 
>
> You can find the policy in cfe_internal/update/update_policy.cf. 
>
> It looks to see if the specified bundle is found and then runs it. 
>
> It becomes an slist because you defined it as a list/array. If defined as 
> a list/array I expect that only the last defined bundle will get run 
> because when it looks to make sure the specified bundle exists it uses 
> bundlesmatching() taking the value of def.mpf_update_policy_bundle as the 
> bundle to search for. 
>
> # Look for a bundle that matches what the user wants"found_matching_user_specified_bundle"
>   slist => bundlesmatching( "$(def.mpf_update_policy_bundle)" );
>
> If def.mpf_update_policy_bundle is a list, then the value of 
> found_matching_user_specified_bundle will be the result of 
> bundlesmatching() against the last iterated element. 
>
> If you want to run multiple bundles for the policy update then you should 
> define just a single bundle which calls the others as methods promises. 
>
> If you want to run other bundles as part of the update policy (not 
> specific to policy update) see 
> def.control_common_update_bundlesequence_end. 
>
> If you think this should be more explicit, perhaps open a PR to add some 
> additional note to the MPF docs or instrument the policy so that it emits 
> reports if def.mpf_update_policy_bundle is not a string ( see type(), 
> introduced in 3.18.0 ), or perhaps based on length 
>

-- 
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 on the web visit https://groups.google.com/d/msgid/help-cfengine/c59efda2-c6cb-47fe-a10f-69f9c8dbac45n%40googlegroups.com.