Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-3634

Support Modularity in the yum package module

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Open
    • Priority: High
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: package_module: yum
    • Labels:
      None
    • Story Points:
      5

      Description

      It would be nice if the yum package module supported Modularity.
      In the current implementation the yum defaults allow for the yum packages module to install software from a module stream that is marked as default.

      For example, here we can see that the 1.14 stream common profile is the default:

      [root@localhost ~]# yum module list nginx
      Last metadata expiration check: 0:26:00 ago on Tue 20 Apr 2021 05:42:16 PM UTC.
      CentOS Linux 8 - AppStream
      Name                             Stream                             Profiles                             Summary                                  
      nginx                            1.14 [d]                           common [d]                           nginx webserver                          
      nginx                            1.16                               common [d]                           nginx webserver                          
      nginx                            1.18                               common [d]                           nginx webserver                          
      
      Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
      

      This policy works without any specific support for Modularity.

      Example policy that works without any specific support for Modularity
      bundle agent main
      {
        packages:
            "nginx"
              policy => "present";
      
        reports:
      
            "$(with)" with => storejson( packagesmatching( "nginx", ".*", ".*", ".*" ) );
      }
      
          info: Successfully installed package 'nginx'
      R: [
        {
          "arch": "x86_64",
          "method": "yum",
          "name": "nginx",
          "version": "1.14.1-9.module_el8.0.0+184+e34fea82"
        }
      ]
      
      

      I think that we should add support for Modularity via the options attribute.

      Proposed example syntax
      #$ dnf module install NAME
      #$ dnf module install NAME:STREAM
      #$ dnf NAME/PROFILE
      #$ dnf module install NAME:STREAM/PROFILE
      # For example, to switch from Node.js 8 to Node.js 10, run:
      #
      # $ dnf module reset nodejs
      # $ dnf module install nodejs:10
      
      
      bundle agent __main__
      {
        packages:
            # if there is a /default/ module stream enabled, then NAME will just install from that default stram.
            "NAME"
              package_method => yum;
      
            # I want to install nginx from stream 1.16
            # [root@localhost ~]# yum module install -y nginx:1.16
            "nginx"
              package_method => yum,
              options => { "module:stream=1.16" };
      
            # I want to install nginx from stream 1.16, profile common
            # [root@localhost ~]# yum module install -y nginx:1.16/common
            "nginx"
              package_method => yum,
              options => { "module:stream=1.16", "module:profile=common" };     
      
            # I want to install nginx from stream 1.18, profile common even if it's already installed from another stream
            # [root@localhost ~]# yum module reset -y nginx; yum module install -y nginx:1.18/common
            "nginx"
              package_method => yum,
              options => { "module:stream=1.18", "module:profile=common",
                           "module:remove_and_reset_if_necessary=true"};     
      
            # TBD: What about switching RPMs that are not in a profile of a stream?
            #      - How would we know this needs to be done?
            #      - Enabling/Disabling a specific stream would need to be a separate promise, commands promise OR new custom promise type.
            # yum module reset ruby
            # yum module enable ruby:2.6
            # yum module --allowerasing distro-sync
      
      }
      

      NOTES:

      • Package inventory will not know the specific stream/profile that a package came from, it will simply know the software and version where version will contain module specific stuff but isn't necessarily human readable.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              a10042 Nick Anderson
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: