From: Alfredo Deza Date: Mon, 25 Nov 2013 19:42:02 +0000 (-0600) Subject: move the choose_init module to hosts X-Git-Tag: v1.3.3~4^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=497ee9c3faafbbc69e0ad843c52f4401fdf329a8;p=ceph-deploy.git move the choose_init module to hosts Signed-off-by: Alfredo Deza --- diff --git a/ceph_deploy/hosts/__init__.py b/ceph_deploy/hosts/__init__.py index f4ba203..98313f0 100644 --- a/ceph_deploy/hosts/__init__.py +++ b/ceph_deploy/hosts/__init__.py @@ -5,7 +5,7 @@ that remote host and set all the special cases for running commands depending on the type of distribution/version we are dealing with. """ import logging -from ceph_deploy import exc, lsb +from ceph_deploy import exc from ceph_deploy.hosts import debian, centos, fedora, suse, remotes from ceph_deploy.connection import get_connection @@ -47,7 +47,7 @@ def get(hostname, username=None, fallback=None): module.codename = codename module.conn = conn module.machine_type = machine_type - module.init = lsb.choose_init(distro_name, codename) + module.init = _choose_init(distro_name, codename) return module @@ -75,8 +75,19 @@ def _normalized_distro_name(distro): distro = distro.lower() if distro.startswith(('redhat', 'red hat')): return 'redhat' - elif distro.startswith(('scientific', 'scientific linux')): + elif distro.startswith(('scientific', 'scientific linux')): return 'scientific' 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'