From: Loic Dachary Date: Thu, 27 Aug 2015 20:08:46 +0000 (+0200) Subject: ceph-disk: {CentOS,RHEL} >= 7 && Fedora >= 22 are systemd X-Git-Tag: v9.1.0~252^2^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cc21514bba98fca300cc2364ba02576f1f2fc63b;p=ceph.git ceph-disk: {CentOS,RHEL} >= 7 && Fedora >= 22 are systemd http://tracker.ceph.com/issues/12786 Fixes: #12786 Signed-off-by: Loic Dachary --- diff --git a/src/ceph-detect-init/ceph_detect_init/centos/__init__.py b/src/ceph-detect-init/ceph_detect_init/centos/__init__.py index f7bf85beda8c..b9738a73b398 100644 --- a/src/ceph-detect-init/ceph_detect_init/centos/__init__.py +++ b/src/ceph-detect-init/ceph_detect_init/centos/__init__.py @@ -8,4 +8,6 @@ def choose_init(): Returns the name of a init system (upstart, sysvinit ...). """ + if release and int(release.split('.')[0]) >= 7: + return 'systemd' return 'sysvinit' diff --git a/src/ceph-detect-init/ceph_detect_init/fedora/__init__.py b/src/ceph-detect-init/ceph_detect_init/fedora/__init__.py index f7bf85beda8c..566f8e37e99c 100644 --- a/src/ceph-detect-init/ceph_detect_init/fedora/__init__.py +++ b/src/ceph-detect-init/ceph_detect_init/fedora/__init__.py @@ -8,4 +8,6 @@ def choose_init(): Returns the name of a init system (upstart, sysvinit ...). """ + if release and int(release.split('.')[0]) >= 22: + return 'systemd' return 'sysvinit' diff --git a/src/ceph-detect-init/ceph_detect_init/rhel/__init__.py b/src/ceph-detect-init/ceph_detect_init/rhel/__init__.py index f7bf85beda8c..b9738a73b398 100644 --- a/src/ceph-detect-init/ceph_detect_init/rhel/__init__.py +++ b/src/ceph-detect-init/ceph_detect_init/rhel/__init__.py @@ -8,4 +8,6 @@ def choose_init(): Returns the name of a init system (upstart, sysvinit ...). """ + if release and int(release.split('.')[0]) >= 7: + return 'systemd' return 'sysvinit' diff --git a/src/ceph-detect-init/tests/test_all.py b/src/ceph-detect-init/tests/test_all.py index 68189bf0187b..069a0ede1f47 100644 --- a/src/ceph-detect-init/tests/test_all.py +++ b/src/ceph-detect-init/tests/test_all.py @@ -38,6 +38,9 @@ logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', class TestCephDetectInit(testtools.TestCase): def test_centos(self): + with mock.patch('ceph_detect_init.centos.release', + '7.0'): + self.assertEqual('systemd', centos.choose_init()) self.assertEqual('sysvinit', centos.choose_init()) def test_debian(self): @@ -49,9 +52,15 @@ class TestCephDetectInit(testtools.TestCase): self.assertEqual('upstart', debian.choose_init()) def test_fedora(self): + with mock.patch('ceph_detect_init.fedora.release', + '22'): + self.assertEqual('systemd', fedora.choose_init()) self.assertEqual('sysvinit', fedora.choose_init()) def test_rhel(self): + with mock.patch('ceph_detect_init.rhel.release', + '7.0'): + self.assertEqual('systemd', rhel.choose_init()) self.assertEqual('sysvinit', rhel.choose_init()) def test_suse(self):