]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
better use of distro.init - thanks Mark Kirkwood! 40/head
authorAlfredo Deza <alfredo@deza.pe>
Tue, 13 Aug 2013 13:10:27 +0000 (09:10 -0400)
committerAlfredo Deza <alfredo@deza.pe>
Tue, 13 Aug 2013 13:12:35 +0000 (09:12 -0400)
Signed-off-by: Alfredo Deza <alfredo@deza.pe>
ceph_deploy/hosts/__init__.py
ceph_deploy/hosts/common.py
ceph_deploy/hosts/debian/mon/create.py

index 182684b3c10ecdc2bba8777d2e6ae9b44eb3b6d6..3cbd01112fbfb7fd2bf62acd058805437269ab82 100644 (file)
@@ -40,6 +40,7 @@ def get(hostname, fallback=None):
     module.release = release
     module.codename = codename
     module.sudo_conn = sudo_conn
+    module.init = lsb.choose_init(distro, codename)
     return module
 
 
index f5e3b8a805f6a499a705b8ab34ca020b3f3d3edd..d17cf716e8d12c93cc386a80ece23abd4cb7e5d5 100644 (file)
@@ -31,12 +31,7 @@ def mon_create(distro, logger, args, monitor_keyring, hostname):
     logger.debug('remote hostname: %s' % hostname)
     path = paths.mon.path(args.cluster, hostname)
     done_path = paths.mon.done(args.cluster, hostname)
-    if distro.name.lower() == 'ubuntu':
-        init = 'upstart'
-    else:
-        init = 'sysvinit'
-
-    init_path = paths.mon.init(args.cluster, hostname, init)
+    init_path = paths.mon.init(args.cluster, hostname, distro.init)
 
     configuration = conf.load(args)
     conf_data = StringIO()
index 1a849c556b9f94c697c252f1714aace946527d51..e317ba3f60eb4420cc1fb203dcfdeea8f1aeb5f8 100644 (file)
@@ -6,7 +6,7 @@ def create(distro, logger, args, monitor_keyring):
     hostname = distro.sudo_conn.modules.socket.gethostname().split('.')[0]
     common.mon_create(distro, logger, args, monitor_keyring, hostname)
 
-    if distro.name.lower() == 'ubuntu':
+    if distro.init == 'upstart': # Ubuntu uses upstart
         check_call(
             distro.sudo_conn,
             logger,
@@ -19,7 +19,7 @@ def create(distro, logger, args, monitor_keyring):
             ],
         )
 
-    else:  # Debian doesn't use initctl
+    elif distro.init == 'sysvinit': # Debian uses sysvinit
         service = common.which_service(distro.sudo_conn, logger)
 
         check_call(
@@ -32,3 +32,5 @@ def create(distro, logger, args, monitor_keyring):
                 'mon.{hostname}'.format(hostname=hostname)
             ],
         )
+    else:
+        raise RuntimeError('create cannot use init %s' % distro.init)