]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
create a utility to verify the service location
authorAlfredo Deza <alfredo@deza.pe>
Fri, 2 Aug 2013 16:45:36 +0000 (12:45 -0400)
committerAlfredo Deza <alfredo@deza.pe>
Fri, 2 Aug 2013 16:45:36 +0000 (12:45 -0400)
Signed-off-by: Alfredo Deza <alfredo@deza.pe>
ceph_deploy/hosts/common.py

index 08ff9caa2adb7235460ee27e84ffa8a57c0318be..d2028da3b158d1223864c3db84a7f110223e2649 100644 (file)
@@ -10,6 +10,18 @@ def ceph_version(conn, logger):
     return check_call(conn, logger, ['ceph', '--version'])
 
 
+def which_service(conn, logger):
+    """
+    Attempt to find the right `service` executable location as it
+    might not be in the path for the user executing the remote
+    calls
+    """
+    locations = ['/sbin/service', '/usr/sbin/service']
+    for location in locations:
+        if conn.modules.os.path.exists(location):
+            return location
+
+
 def mon_create(distro, logger, args, monitor_keyring, hostname):
     logger.debug('remote hostname: %s' % hostname)
     path = paths.mon.path(args.cluster, hostname)