Re: mpf_update_policy_bundle: can this be a list?
"'Nick Anderson' via help-cfengine" <[email protected]> Thu, 22 Jun 2023 11:58:35 -0500
| Newsgroups | gmane.comp.sysutils.cfengine.general |
|---|---|
| Message-ID | <[email protected]> |
Also, there was this blog post about writing a custom update cfbs module: https://cfengine.com/blog/2022/example-custom-policy-update-cfbs-module/ It might also contain some useful information. "'Nick Anderson' via help-cfengine" <[email protected]> writes: > 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 -- Nick Anderson | Doer of Things | (+1) 785-550-1767 | https://northern.tech -- 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/87pm5n5t50.fsf%40northern.tech.