Tripleo Repos Yum Module

Goal

Enable a set of repos and modules

Reference: model after get_hash

https://review.opendev.org/c/openstack/tripleo-repos/+/789535

Data input

https://github.com/mwhahaha/rhos-bootstrap/blob/main/versions/centos.yaml#L37-L40

Execution

Execute dnf/yum command to update the yum module setting.

Cli Design

Enabling a specific module

yum-module enable-module container-tools --module-version 3.0

It will be overriding /etc/dnf/modules.d/container-tools.module

[container-tools]
name=container-tools
stream=3.0 <this part gots overriden>
profiles=
state=enabled

Enabling a specific repo

yum-module enable-repo appstream --enable

It will go into /etc/yum.repos.d/ look for CentOS-Stream-AppStream.repo repo and

[appstream]
name=CentOS-Stream - AppStream
baseurl=https://mirror.mtl01.inap.opendev.org/centos/$stream/AppStream/$basearch/os/
gpgcheck=1
enabled=0 <this part will be change to one>
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

Similar operations needs to be happen for all repos like:

yum-module enable-repo appstream --change-base_url <foobar.xyz>

Unit Tests:

+++++

Use Cases:

  • need rlandy's input for dep pipeline -

    The dependency pipeline is used to test $next. For example with container-tools, that is usually rhel* version or the next stable version. There are also virt modules ( using advanced virt atm). See rhos-release as an example http://git.app.eng.bos.redhat.com/git/rhos-release.git/tree/repos/rhos-release-rhel-8.4.repo

  • Main point is to make sure we single source here and don't enable/disable different versions

  • majority use case.. just to run command and update module

Where this will be available

  • src - tripleo-repos
  • public PyPI

How a consumer would execute

  • python setup
  • pip install
    • command line cli
  • an associated ansible module

Design

  • ConfigParser to edit ini files
  • Argparse for command-line options
  • CLI proposal:
    1. Update yum repo:
    ​​​​sudo tripleo-yum-config repo appstream --enable --set-opts baseurl=http://newurl exclude="some-package*"
    ​​​​sudo tripleo-yum-config repo test-debug --enable --config-file-path /etc/yum.repos.d/test.repo
    
    1. Update yum module:
    ​​​​sudo tripleo-yum-config module nginx --enable --set-opts stream=mainline
    
    1. Update yum global configuration:
    ​​​​sudo tripleo-yum-config global --set-opts keepcache=0 cachedir="/var/cache/dnf"
    
  • Ansible module

Questions

  • Module name:
    • yum-module? yum-config?
  • (dviroel) Is a configuration file required?
    • So far, only yum repo/module file path would be configurable
      • We can consider a config-file-path argument in cli instead

Alternatives

  1. Ansible module alternative:
    - name: Enable appstream repo
      ini_file:
        dest: /etc/yum.repos.d/appstream.repo
        section: appstream
        option: enabled
        value: 1
Select a repo