CreateImageWizard: default to major releases on prem

In RHEL, VERSION_ID actually refers to the minor release. Let's strip
the minor component from it until we actually support those explicitly.
This commit is contained in:
Sanne Raymaekers 2025-02-11 16:54:22 +01:00
parent 3eda8e2dd1
commit 76f86c3711

View file

@ -5,7 +5,12 @@ import { Distributions } from '../../../store/imageBuilderApi';
export const getHostDistro = async () => {
const osRel = await read_os_release();
return `${osRel.ID}-${osRel.VERSION_ID}` as Distributions;
let distro = `${osRel.ID}-${osRel.VERSION_ID}`;
// use major releases, and rely on composer's distro aliasing (rhel)
if (distro.indexOf('.') !== -1) {
distro = distro.split('.')[0];
}
return distro as Distributions;
};
type Architecture = 'x86_64' | 'aarch64';