Re: Package promise had no package_method attribute

Beto <[email protected]> Wed, 17 Jul 2024 12:30:51 -0700 (PDT)
Newsgroups gmane.comp.sysutils.cfengine.general
Message-ID <[email protected]>
Hey Craig,

We see these messages in email and /var/cfengine/outputs.

We have inform => "true" in controls/cf_agent.cf

We haven't added anything to cf-agent execution in controls/cf_execd.cf

We only use cf-execd to run cf-agent.

On Wednesday, July 17, 2024 at 1:07:15 PM UTC-5 [email protected] 
wrote:

> Yes, sorry about the noise. The logging around package promises and why 
> the system would choose v1 (methods) or v2 (modules) was rather lacking so 
> we made some improvements but sadly set the log level a bit wrong.
>
> All of these issues should be fixed in master and 3.21.x for next releases 
> 3.24.0 (New LTS coming soon!) and 3.21.6 (coming later).
>
> And yes, adding package_method => "generic" should fix v1(method) promises.
>
> Where are you seeing the info messages? 
>
> - In emails? That is the ONLY case where the 
> control_executor_mailfilter_exclude would work and even then controls/
> cf_execd.cf would have to have the cf-agent commands modified to include 
> --info log level for you to get that noisy package info level message.
>
> - In /var/cfengine/outputs? Did you change controls/cf_execd.cf and add 
> --info to the cf-agent commands that are run?
>
> - Are you running cf-agent some other way besides cf-execd?
>
> Because we examine many attributes in packages promises to determine which 
> version to use you can include the package_method attribute along with 
> package_module and policy which will cause v2 package modules to be used.
>
> Like this:
>
> packages:
>   "mutt"
>     policy => "present",
>     package_method => generic,
>     package_module => apt_get;
>
> Looking at debug output of an agent run with that policy I see that v2 
> package modules are used as desired:
>
> verbose: Using v2 package promises (package_module)
> debug: New package promise handler
> verbose: P: .........................................................
> verbose: P: BEGIN promise 'promise_main_cf_12' of type "packages" (pass 1)
> verbose: P:    Promiser/affected object: 'mutt'
> verbose: P:    Part of bundle: mpf_main
> verbose: P:    Base context class: any
> verbose: P:    Stack path: /default/mpf_main/packages/'mutt'[1]
> debug: Getting supported API version.
> debug: Opened fds 4 and 7 for command 
> '/var/cfengine/bin/cfengine-selected-python 
> /var/cfengine/modules/packages/apt_get supports-api-version'.
>
>
> On Tue, Jul 16, 2024 at 7:29 AM 'Bas van der Vlies' via help-cfengine <
> [email protected]> wrote:
>
>> Looks strange bu I suppress it by:
>> ```
>>      packages: 
>>
>>
>>          !version_specified:: 
>>
>>
>>              "$(package)" 
>>
>>
>>                  policy => "$(action)", 
>>
>>
>>                  package_method => generic, 
>>
>>
>>                  options => { "$(options)" };
>> ```
>>
>> I only use version 2 and do not version 1 package management any more. I 
>> will remove it when a new version has been released.
>>
>>
>> On 16/07/2024 14:14, 'Bas van der Vlies' via help-cfengine wrote:
>> > This is a bug. The message should be “DEBUG” but is “INFO”. They have 
>> fixed it but not yet released a new cfengine 3.21 version, see:
>> >   * https://northerntech.atlassian.net/browse/CFE-4398
>> > 
>> > 
>> > 
>> >> On 16 Jul 2024, at 00:34, Beto <[email protected]> wrote:
>> >>
>> >> I tried
>> >>
>> >>          "control_executor_mailfilter_exclude": {
>> >>            "value": [ ".*no package_method attribute.*" ]
>> >>
>> >> but it's not working for some reason. :(
>> >>
>> >> On Monday, July 15, 2024 at 5:18:20 PM UTC-5 Beto wrote:
>> >> Since upgrading from cfengine-community 3.18 to CFEngine Enterprise 
>> 3.21.5 I'm seeing this on every host every time the agent runs:
>> >>
>> >> info: Package promise had no package_method attribute so it's being 
>> assigned a value of 'generic' as default.
>> >> .
>> >> This is repeated from 6 to ~150 times during each execution probably 
>> depending on classes.
>> >>
>> >> This seems like a misclassed message that should only be written in 
>> verbose or debug mode.
>> >>
>> >> Any ideas?
>> >>
>> >> Here's a sample bundle to show the issue:
>> >>
>> >> body common control
>> >> {
>> >>          bundlesequence => {
>> >>                  "main",
>> >>          };
>> >> }
>> >>
>> >> body file control
>> >> {
>> >>    inputs => { "/var/cfengine/inputs/lib/packages.cf" };
>> >> }
>> >>
>> >> bundle agent main
>> >> {
>> >>          methods:
>> >>
>> >>                  "any" usebundle => packages;
>> >> }
>> >>
>> >> bundle agent packages {
>> >>    vars:
>> >>      redhat_7::
>> >>        "redhat_7_baseline_packages"
>> >>          comment => "install rhel7 baseline packages",
>> >>          slist   => {
>> >>            "at",
>> >>            "audispd-plugins",
>> >>            };
>> >>
>> >>        "redhat_7_baseline_packages"
>> >>          comment => "install rhel7 baseline packages",
>> >>          if      => "g_ovpa",
>> >>          slist   => {
>> >>            @(redhat_7_baseline_packages),
>> >>            "xinetd"
>> >>            };
>> >>
>> >>        "redhat_7_real_packages"
>> >>          comment => "install rhel7 real machine packages",
>> >>          slist   => {
>> >>            "device-mapper-multipath",
>> >>            "device-mapper-multipath-libs",
>> >>            "sg3_utils"
>> >>            };
>> >>
>> >>        "redhat_7_developer_packages"
>> >>          comment => "install rhel7 developer packages",
>> >>          slist   => {
>> >>            "gcc"
>> >>            };
>> >>
>> >>        "redhat_7_delete_packages"
>> >>          comment => "rhel7 wireless packages",
>> >>          slist   => {
>> >>            "iwl6050-firmware",
>> >>            };
>> >>
>> >>        "redhat_7_delete_packages"
>> >>          comment => "rhel7 firmware packages",
>> >>          slist   => {
>> >>            @(redhat_7_delete_packages),
>> >>            "ivtv-firmware" };
>> >>
>> >>        "redhat_7_delete_packages"
>> >>          comment => "rhel7 miscelleneous packages",
>> >>          slist   => {
>> >>            @(redhat_7_delete_packages),
>> >>            "NetworkManager-tui",
>> >>            "NetworkManager-team",
>> >>            "NetworkManager-config-server",
>> >>            };
>> >>
>> >>        "redhat_7_delete_packages"
>> >>          comment => "rhel7 ovpa packages",
>> >>          slist   => {
>> >>            @(redhat_7_delete_packages),
>> >>            "xinetd"
>> >>            };
>> >>
>> >>    packages:
>> >>      redhat_7::
>> >>        "$(redhat_7_baseline_packages)"
>> >>          comment         => "Install rhel7 baseline packages",
>> >>          policy          => "present",
>> >>          version         => "latest",
>> >>          package_module  => yum;
>> >>
>> >>        "$(redhat_7_real_packages)"
>> >>          comment         => "Install rhel7 real machine packages",
>> >>          policy          => "present",
>> >>          version         => "latest",
>> >>          package_module  => yum;
>> >>
>> >>        "$(redhat_7_developer_packages)"
>> >>          comment         => "Install rhel7 developer packages",
>> >>          policy          => "present",
>> >>          version         => "latest",
>> >>          package_module  => yum;
>> >>
>> >>        "$(redhat_7_delete_packages)"
>> >>          comment         => "Delete rhel7 packages",
>> >>          policy          => "absent",
>> >>          package_module  => yum;
>> >>
>> >> }
>> >>
>> >>
>> >>
>> >>
>> >> -- 
>> >> 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/87e1a57d-4e2c-4b27-a160-ca1815a3a739n%40googlegroups.com
>> .
>> > 
>>
>> -- 
>> --
>> Bas van der Vlies
>> | High Performance Computing & Visualization | SURF| Science Park 140 | 
>> 1098 XG  Amsterdam
>> | T +31 (0) 20 800 1300 <+31%2020%20800%201300>  | [email protected] | 
>> www.surf.nl |
>>
>> -- 
>> 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/a40e51d2-6edb-4a23-b43e-011864c83a8a%40surf.nl
>> .
>>
>
>
> -- 
>
> *Craig Comstock* (he/him)
> CFEngineer/Digger | CFEngine <https://cfengine.com/>
> Kansas, USA
>  <https://www.linkedin.com/company/northern.tech> <https://twitter.com/northerntechhq> <https://northern.tech> Northern.tech <https://northern.tech> | Securing the world's connected devices
>
>

-- 
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/927882ae-cd8a-4db8-b2bf-a65ebd982766n%40googlegroups.com.