Re: update_policy.cf fails in 3.18.1
"'Nick Anderson' via help-cfengine" <[email protected]>
| Newsgroups | gmane.comp.sysutils.cfengine.general |
|---|---|
| Message-ID | <[email protected]> |
Is the problem that your update bundle does not have the namespace
specified?
[root@hub ~]# cat /var/cfengine/inputs/def.json
{
"vars": {
"update_inputs": [ "update_templates.cf" ],
"mpf_update_policy_bundle": "default:update_templates"
}
}
You have new mail in /var/spool/mail/root
[root@hub ~]# cat /var/cfengine/inputs/update_templates.cf
bundle agent update_templates
{
reports: "Hello from $(this.bundle) in $(this.promise_filename)";
}
[root@hub ~]# cf-agent -KIf /var/cfengine/inputs/update.cf
R: Hello from update_templates in /var/cfengine/inputs/update_templates.cf
R: Found user specified update bundle.
R: User specified update bundle: default:update_templates
[root@hub ~]# cf-agent -V
CFEngine Core 3.18.1
CFEngine Enterprise 3.18.1
On Friday, March 4, 2022 at 10:20:10 AM UTC-6 Beto wrote:
> Thanks, Nick. There still seems to be a gap in my understanding.
>
> Here's where the update bundle is specified:
>
> root@butcher1 [cfengine]# cf-promises -f ./inputs/update.cf
> --show-vars=default.def.mpf_update_policy_bundle
> Variable name Variable value
> Meta tags
> Comment
> default:def.mpf_update_policy_bundle update_templates
> source=augments_file
>
> Hers's where the input containing the update bundle is defined:
>
> root@butcher1 [cfengine]# cf-promises -f ./inputs/update.cf
> --show-vars=default.def.update_inputs
> Variable name Variable value
> Meta tags
> Comment
> default:def.update_inputs {"/var/cfengine/inputs/
> update_templates.cf"} source=augments_file
>
> Here's the input file:
>
> root@butcher1 [cfengine]# grep bundle inputs/update_templates.cf
> bundle agent update_templates {
>
> So what am I missing?
>
> On Thursday, March 3, 2022 at 10:59:33 AM UTC-6 Nick Anderson wrote:
>
>> Beta writes:
>>
>> Again how can the user update bundle be BOTH found and missing? Please
>> tell me I'm missing something.
>>
>> Let's see …
>>
>> Found user specified update bundle and User specified update budnle: are
>> emited when have_user_specified_update_bundle is defined.
>>
>>
>> "Found user specified update bundle."
>> if => "have_user_specified_update_bundle";
>>
>> "User specified update bundle: $(def.mpf_update_policy_bundle)"
>> if => "have_user_specified_update_bundle";
>>
>> have_user_specified_update_bundle is defined when the variable
>> def.mpf_update_policy_bundle is defined.
>>
>>
>> "have_user_specified_update_bundle"
>> expression => isvariable( "def.mpf_update_policy_bundle" );
>>
>> We can see that the variable is not defined by default.
>>
>>
>> masterfiles$ git grep mpf_update_policy_bundle
>> MPF.md:Override this bundle by setting `def.mpf_update_policy_bundle` via augments:
>> MPF.md: "mpf_update_policy_bundle": "MyCustomPolicyUpdateBundle"
>> cfe_internal/update/update_policy.cf:# @description Users may define `def.mpf_update_policy_bundle` to override the
>> cfe_internal/update/update_policy.cf: expression => isvariable( "def.mpf_update_policy_bundle" );
>> cfe_internal/update/update_policy.cf: slist => bundlesmatching( "$(def.mpf_update_policy_bundle)" );
>> cfe_internal/update/update_policy.cf: "User specified update bundle: $(def.mpf_update_policy_bundle)"
>>
>> User specified update budnle MISSING! is emitted when both
>> have_user_specified_update_bundle and
>> missing_user_specified_update_bundle are defined.
>>
>>
>> "User specified update bundle MISSING! Falling back to $(default_policy_update_bundle)."
>> if => and( "have_user_specified_update_bundle",
>> "missing_user_specified_update_bundle"
>> );
>>
>> missing_user_specified_update_bundle is defined when there are not any
>> elements in found_matching_user_specified_bundle matching .*.
>>
>>
>> "missing_user_specified_update_bundle"
>> not => some(".*", "found_matching_user_specified_bundle");
>>
>> And, found_matchign_user_specified_bundle is defined by searching for a
>> bundle matching the value def.mpf_update_policy_bundle.
>>
>>
>> "found_matching_user_specified_bundle"
>> slist => bundlesmatching( "$(def.mpf_update_policy_bundle)" );
>>
>> So, if you specify an update bundle and it's not actually defined, then
>> you have this case where it's both found (to be defined) and missing
>> because it's not actually defined.
>>
>> If you want to open a pull request with improved language for describing
>> the conditions I am happy to review them.
>>
>
--
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/b1c794d6-cb1c-4013-acc5-c70cdb30b3bcn%40googlegroups.com.