Uploaded image for project: 'Satellite'
  1. Satellite
  2. SAT-27276

The foreman-protector plugin does not work with dnf-automatic

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False
    • rubygem-foreman_maintain-1.7.0
    • 0
    • Moderate
    • None

      Description of problem:

      The foreman-protector plugin relies on specific sub-command executions by yum\dnf because of the way it is designed and works as expected when someone is trying to use dnf\yum to install\update packages on a satellite or capsule.

      But if a user has dnf-automatic enabled and configured, Then dnf-automatic fails to load and use the foreman-protector plugin and proceeds with OS patching when OS updates were available. 

       

      How reproducible:

      Always

       

      Is this issue a regression from an earlier version:

      No

       

      Steps to Reproduce:

      1. On a Satellite 6.14 or 6.15, configure dnf-automatic plugin

      2. Set download_updates to yes and apply_updates to no in /etc/dnf/automatic.conf 

      3. Run the command `/usr/bin/dnf-automatic` manually instead for waiting for it to start as per schedule. 

       

      Actual behavior:

       

      # /usr/bin/dnf-automatic
      Updating Subscription Management repositories.
      Traceback (most recent call last):
        File "/usr/lib/python3.6/site-packages/dnf/plugin.py", line 107, in _caller
          getattr(plugin, method)()
        File "/usr/lib/python3.6/site-packages/dnf-plugins/foreman-protector.py", line 54, in sack
          if self.cli is not None and self.cli.command._basecmd not in PROTECT_COMMANDS:
      AttributeError: 'NoneType' object has no attribute '_basecmd'
      The following updates were downloaded on 'satellite614.example.com':
      ==============================================================================================================================
       Package           Arch   Version           Repository                     Size
      ==============================================================================================================================
      Installing:
       kernel            x86_64 4.18.0-553.16.1.el8_10
                                                  rhel-8-for-x86_64-baseos-rpms  10 M
       kernel-core       x86_64 4.18.0-553.16.1.el8_10
                                                  rhel-8-for-x86_64-baseos-rpms  43 M
      ..
      ..
       systemd-pam       x86_64 239-82.el8_10.1   rhel-8-for-x86_64-baseos-rpms 513 k
       systemd-udev      x86_64 239-82.el8_10.1   rhel-8-for-x86_64-baseos-rpms 1.6 M
       wget              x86_64 1.19.5-12.el8_10  rhel-8-for-x86_64-appstream-rpms
                                                                                734 k
      Transaction Summary
      ==============================================================================================================================
      Install   3 Packages
      Upgrade  80 Packages
      The downloaded packages were saved in cache until the next successful transaction.
      You can remove cached packages by executing 'dnf clean packages'.
      

       

       

      Probably because of the way we define and evaluate  the `PROTECT_COMMANDS` values  

      1. grep PROTECT_COMMANDS /usr/lib/python3.6/site-packages/dnf-plugins/foreman-protector.py -A2
        PROTECT_COMMANDS = ('install', 'downgrade', 'reinstall', 'distro-sync', 'swap', 'upgrade', 'upgrade-minimal')

      class ForemanProtector(dnf.Plugin):

      if self.cli is not None and self.cli.command._basecmd not in PROTECT_COMMANDS:
      return
      whitelist_and_obsoletes = self._add_obsoletes()
       

      Expected behavior:

      It should not throw any traceback and behave the same way as normal yum\dnf command does. 

       

      Business Impact / Additional info:

       

      We don't mention anywhere about not using dnf-automatic on satellite or capsules and hence there's nothing blocking the users from configuring it who wants their OS to be up-to-date . But that often breaks satellite since no installer execution would be done. 

            egolov@redhat.com Evgeni Golov
            rhn-support-saydas Sayan Das
            Radek Mynar Radek Mynar
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: