]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
move the choose_init module to hosts
authorAlfredo Deza <alfredo.deza@inktank.com>
Mon, 25 Nov 2013 19:42:02 +0000 (13:42 -0600)
committerAlfredo Deza <alfredo.deza@inktank.com>
Mon, 25 Nov 2013 19:42:02 +0000 (13:42 -0600)
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
ceph_deploy/hosts/__init__.py

index f4ba2036b3a130c0eef4983d6658330865042ff8..98313f0864b2ab78b64d53960dc011a352073eb0 100644 (file)
@@ -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'