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
import re
+from packaging.version import parse as parse_version, Version
+
+
DISTRO_CODENAME_MAP = {
"ubuntu": {
"24.04": "noble",
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'
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
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'