From: Owen Synge Date: Fri, 11 Jul 2014 12:47:11 +0000 (+0200) Subject: now correctly selects sysvinit or systemd for SLE_11 SLE_12 and openSUSE_13.1 X-Git-Tag: v1.5.9~4^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8edcca9a4dfe39a09ac6ba13183d397e2ef412e3;p=ceph-deploy.git now correctly selects sysvinit or systemd for SLE_11 SLE_12 and openSUSE_13.1 --- diff --git a/ceph_deploy/hosts/__init__.py b/ceph_deploy/hosts/__init__.py index a80a704..028b800 100644 --- a/ceph_deploy/hosts/__init__.py +++ b/ceph_deploy/hosts/__init__.py @@ -55,8 +55,7 @@ def get(hostname, username=None, fallback=None): module.codename = codename module.conn = conn module.machine_type = machine_type - module.init = _choose_init(distro_name, codename) - + module.init = module.choose_init() return module @@ -87,14 +86,3 @@ def _normalized_distro_name(distro): elif distro.startswith(('suse', 'opensuse')): return 'suse' return distro - - -def _choose_init(distro, codename): - """ - Select a init system for a given distribution. - - Returns the name of a init system (upstart, sysvinit ...). - """ - if distro == 'Ubuntu': - return 'upstart' - return 'sysvinit' diff --git a/ceph_deploy/hosts/centos/__init__.py b/ceph_deploy/hosts/centos/__init__.py index c03ed63..d976523 100644 --- a/ceph_deploy/hosts/centos/__init__.py +++ b/ceph_deploy/hosts/centos/__init__.py @@ -9,3 +9,6 @@ from uninstall import uninstall # noqa distro = None release = None codename = None + +def choose_init(): + return 'sysvinit' diff --git a/ceph_deploy/hosts/debian/__init__.py b/ceph_deploy/hosts/debian/__init__.py index c2805bd..f82537e 100644 --- a/ceph_deploy/hosts/debian/__init__.py +++ b/ceph_deploy/hosts/debian/__init__.py @@ -9,3 +9,8 @@ from uninstall import uninstall # noqa distro = None release = None codename = None + +def choose_init(): + if distro == 'Ubuntu': + return 'upstart' + return 'sysvinit' diff --git a/ceph_deploy/hosts/fedora/__init__.py b/ceph_deploy/hosts/fedora/__init__.py index 0bfd29f..9f0f2bc 100644 --- a/ceph_deploy/hosts/fedora/__init__.py +++ b/ceph_deploy/hosts/fedora/__init__.py @@ -10,3 +10,6 @@ from uninstall import uninstall # noqa distro = None release = None codename = None + +def choose_init(): + return 'sysvinit' diff --git a/ceph_deploy/hosts/suse/__init__.py b/ceph_deploy/hosts/suse/__init__.py index c2805bd..33e19a9 100644 --- a/ceph_deploy/hosts/suse/__init__.py +++ b/ceph_deploy/hosts/suse/__init__.py @@ -2,10 +2,23 @@ import mon # noqa import pkg # noqa from install import install, mirror_install, repo_install # noqa from uninstall import uninstall # noqa +import logging # Allow to set some information about this distro # +log = logging.getLogger(__name__) + distro = None release = None codename = None + +def choose_init(): + initMapping = { '11' : 'sysvinit', # SLE_11 + '12' : 'systemd', # SLE_12 + '13.1' : 'systemd', # openSUSE_13.1 + } + if release in initMapping: + log.debug("init=%s" % (initMapping[release])) + return initMapping[release] + return 'sysvinit'