]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
opsys: Handle CentOS Stream more appropriately
authorZack Cerza <zack@redhat.com>
Tue, 4 Jun 2024 22:45:31 +0000 (16:45 -0600)
committerZack Cerza <zack@redhat.com>
Tue, 4 Jun 2024 23:13:25 +0000 (17:13 -0600)
This fixes an inconsistency where we'd change "centosX.stream" to "centosX" when
a job starts, submitting that to paddles.

Signed-off-by: Zack Cerza <zack@redhat.com>
docs/docker-compose/testnode/testnode_start.sh
teuthology/orchestra/opsys.py
teuthology/orchestra/test/test_opsys.py

index 196d8a76f61330abba42ec9aca365400a49d6045..6da13a7d02c14fca1223bd0155a97824cb7d552b 100755 (executable)
@@ -3,6 +3,7 @@ set -x
 echo "$SSH_PUBKEY" > /root/.ssh/authorized_keys
 echo "$SSH_PUBKEY" > /home/ubuntu/.ssh/authorized_keys
 chown ubuntu /home/ubuntu/.ssh/authorized_keys
+. /etc/os-release
 if [ $ID = 'centos' ]; then
     VERSION_ID=${VERSION_ID}.stream
 fi
index ae9b14910ac59fa65f2c153384002d16a25b4b55..1337540422c82e78b6c8d1527bf3331b3295d70b 100644 (file)
@@ -1,5 +1,8 @@
 import re
 
+from packaging.version import parse as parse_version, Version
+
+
 DISTRO_CODENAME_MAP = {
     "ubuntu": {
         "24.04": "noble",
@@ -173,6 +176,7 @@ class OS(object):
             package_type = 'deb'
         """
         str_ = os_release_str.strip()
+        version = cls._get_value(str_, 'VERSION_ID')
         name = cls._get_value(str_, 'ID').lower()
         if name == 'sles':
             name = 'sle'
@@ -180,9 +184,10 @@ class OS(object):
             name = 'opensuse'
         elif name == 'opensuse-tumbleweed':
             name = 'opensuse'
-        version = cls._get_value(str_, 'VERSION_ID')
+        elif name == 'centos':
+            if parse_version(version) >= Version("8.0"):
+                version = f"{version}.stream"
         obj = cls(name=name, version=version)
-
         return obj
 
 
index 4be890dab2924d49955c8ca07fa30cbc6e541f9c..fed0e702583bcea062c0af5a34291d55e70b20f5 100644 (file)
@@ -255,7 +255,7 @@ class TestOS(object):
     def test_centos_9_os_release(self):
         os = OS.from_os_release(self.str_centos_9_os_release)
         assert os.name == 'centos'
-        assert os.version == '9'
+        assert os.version == '9.stream'
         assert os.codename == 'stream'
         assert os.package_type == 'rpm'