From 26008e8a7299acf8f7599f6d7019b60ccd44fa56 Mon Sep 17 00:00:00 2001 From: James Page Date: Wed, 9 Dec 2015 10:34:38 +0000 Subject: [PATCH] ceph-detect-init: Ubuntu >= 15.04 uses systemd Ubuntu releases since Ubuntu 15.04 use systemd instead of upstart; teach ceph-detect-init that this is the case, thus avoiding OSD devices on systemd based installs being marked as managed by upstart by ceph-disk. Signed-off-by: James Page --- src/ceph-detect-init/ceph_detect_init/debian/__init__.py | 5 ++++- src/ceph-detect-init/tests/test_all.py | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ceph-detect-init/ceph_detect_init/debian/__init__.py b/src/ceph-detect-init/ceph_detect_init/debian/__init__.py index 7209ff6ba192..59b47816f470 100644 --- a/src/ceph-detect-init/ceph_detect_init/debian/__init__.py +++ b/src/ceph-detect-init/ceph_detect_init/debian/__init__.py @@ -9,5 +9,8 @@ def choose_init(): Returns the name of a init system (upstart, sysvinit ...). """ if distro.lower() in ('ubuntu', 'linuxmint'): - return 'upstart' + if codename >= 'vivid': + return 'systemd' + else: + return 'upstart' return 'sysvinit' diff --git a/src/ceph-detect-init/tests/test_all.py b/src/ceph-detect-init/tests/test_all.py index 069a0ede1f47..4c408f9b507d 100644 --- a/src/ceph-detect-init/tests/test_all.py +++ b/src/ceph-detect-init/tests/test_all.py @@ -50,6 +50,9 @@ class TestCephDetectInit(testtools.TestCase): with mock.patch('ceph_detect_init.debian.distro', 'ubuntu'): self.assertEqual('upstart', debian.choose_init()) + with mock.patch('ceph_detect_init.debian.codename', + 'vivid'): + self.assertEqual('systemd', debian.choose_init()) def test_fedora(self): with mock.patch('ceph_detect_init.fedora.release', -- 2.47.3