From: Nathan Cutler Date: Wed, 18 Jul 2018 08:33:26 +0000 (+0200) Subject: tools: ceph-detect-init: support SLED X-Git-Tag: v12.2.13~129^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8de93d73410f967a6aa06264dfc11936e9ed2575;p=ceph.git tools: ceph-detect-init: support SLED SUSE Linux Enterprise (SLE) comes in two variants: SLES (for servers) and SLED (for desktops). This commit adds support for the desktop variant as well as adding test cases for SLE 15. This commit is not cherry-picked because ceph-detect-init has been dropped in master. References: http://tracker.ceph.com/issues/18163 Signed-off-by: Nathan Cutler (cherry picked from commit 07bff8528ea21959fd5ba2179169d08a6f23c529) --- diff --git a/src/ceph-detect-init/ceph_detect_init/__init__.py b/src/ceph-detect-init/ceph_detect_init/__init__.py index 9a0fcba1d5d..6c335f5b98f 100644 --- a/src/ceph-detect-init/ceph_detect_init/__init__.py +++ b/src/ceph-detect-init/ceph_detect_init/__init__.py @@ -92,7 +92,7 @@ def _normalized_distro_name(distro): return 'redhat' elif distro.startswith(('scientific', 'scientific linux')): return 'scientific' - elif distro.startswith(('suse', 'opensuse', 'sles')): + elif distro.startswith(('suse', 'opensuse', 'sles', 'sled')): return 'suse' elif distro.startswith('centos'): return 'centos' diff --git a/src/ceph-detect-init/tests/test_all.py b/src/ceph-detect-init/tests/test_all.py index a831078ba53..52334e6756e 100644 --- a/src/ceph-detect-init/tests/test_all.py +++ b/src/ceph-detect-init/tests/test_all.py @@ -451,6 +451,34 @@ CPE_NAME="cpe:/o:suse:sles:12:sp3" os_release_sles_12_3, 'ID')) self.assertEqual('12.3', ceph_detect_init._extract_from_os_release( os_release_sles_12_3, 'VERSION_ID')) + os_release_sled_15 = """ +NAME="SLED" +VERSION="15" +VERSION_ID="15" +PRETTY_NAME="SUSE Linux Enterprise Desktop 15" +ID="sled" +ID_LIKE="suse" +ANSI_COLOR="0;32" +CPE_NAME="cpe:/o:suse:sled:15" +""" + self.assertEqual('sled', ceph_detect_init._extract_from_os_release( + os_release_sled_15, 'ID')) + self.assertEqual('15', ceph_detect_init._extract_from_os_release( + os_release_sled_15, 'VERSION_ID')) + os_release_sles_15 = """ +NAME="SLES" +VERSION="15" +VERSION_ID="15" +PRETTY_NAME="SUSE Linux Enterprise Server 15" +ID="sles" +ID_LIKE="suse" +ANSI_COLOR="0;32" +CPE_NAME="cpe:/o:suse:sles:15" +""" + self.assertEqual('sles', ceph_detect_init._extract_from_os_release( + os_release_sles_15, 'ID')) + self.assertEqual('15', ceph_detect_init._extract_from_os_release( + os_release_sles_15, 'VERSION_ID')) os_release_opensuse_tumbleweed_old_style = """ NAME="openSUSE Tumbleweed" # VERSION="20170502"