[CentOS-devel] releasever does not contain variant as expected

Wed Dec 8 09:00:32 UTC 2021
Marc Dequènes (Duck) <duck at redhat.com>

Quack,

(this is a post I made for centos@ on 2021-10-27 and that never made it 
on the list for some unknown reason; retrying here since it's still current)

I'm trying to install CentOS Stream directly without switching from 
Linux to Stream in our automated install. The changes were 
straightforward but I was very surprised to get CentOS Linux instead of 
the expected CentOS Stream.

I captured the virt-install call to check if there was any mistake and 
that's fine:
virt-install -n taiste.osci.io --memory=2048,maxmemory=4096 --memballoon 
virtio --disk bus=virtio,path=/dev/vg_Spritz/taiste.osci.io 
--vcpus=1,maxvcpus=2 
--initrd-inject=/etc/libvirt/kickstarts/taiste.osci.io/ks.cfg 
--autostart --noautoconsole --watchdog default --arch x86_64 -l 
http://mirror.rackspace.com/CentOS/8-stream/BaseOS/x86_64/os/ --network 
bridge=virbr0,model=virtio --graphics none -x 'net.ifnames=0 
inst.ks=file:/ks.cfg ks=file:/ks.cfg console=tty0 console=ttyS0'

Our kickstart (ks.cfg) contains:
  url 
--mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS
and that has worked for ages.

Digging deeper I found out $releasever only contains the major version 
without the variant (like "6Server" on RHEL for eg).

DNF is using a new variable $stream that breaks compatibility with the 
past and AFAIK is only available through DNF (but I can't use it in the 
kickstart for all versions anyway).

Since we're using Ansible I can work around that but I was wondering if 
there was any way to handle this better in a retro-compatible way.

Regards.
\_o<