]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
[RM-11115] prevent osd actions if ceph is not installed
authorAlfredo Deza <adeza@redhat.com>
Tue, 11 Aug 2015 22:19:35 +0000 (18:19 -0400)
committerAlfredo Deza <adeza@redhat.com>
Thu, 13 Aug 2015 12:32:00 +0000 (08:32 -0400)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
ceph_deploy/osd.py

index b3e8a8d1691bfb1c330ae08b7b68214be44b69a8..c5d54afc8a1d14cd1429bcaa60dd3cb3b6309adb 100644 (file)
@@ -10,7 +10,7 @@ from textwrap import dedent
 from cStringIO import StringIO
 
 from ceph_deploy import conf, exc, hosts, mon
-from ceph_deploy.util import constants, system
+from ceph_deploy.util import constants, system, packages
 from ceph_deploy.cliutil import priority
 from ceph_deploy.lib import remoto
 
@@ -290,7 +290,11 @@ def prepare(args, cfg, activate_prepared_disk):
             if disk is None:
                 raise exc.NeedDiskError(hostname)
 
-            distro = hosts.get(hostname, username=args.username)
+            distro = hosts.get(
+                hostname,
+                username=args.username,
+                callbacks=[packages.ceph_is_installed]
+            )
             LOG.info(
                 'Distro info: %s %s %s',
                 distro.name,
@@ -352,7 +356,11 @@ def activate(args, cfg):
 
     for hostname, disk, journal in args.disk:
 
-        distro = hosts.get(hostname, username=args.username)
+        distro = hosts.get(
+            hostname,
+            username=args.username,
+            callbacks=[packages.ceph_is_installed]
+        )
         LOG.info(
             'Distro info: %s %s %s',
             distro.name,
@@ -393,7 +401,11 @@ def disk_zap(args):
         if not disk or not hostname:
             raise RuntimeError('zap command needs both HOSTNAME and DISK but got "%s %s"' % (hostname, disk))
         LOG.debug('zapping %s on %s', disk, hostname)
-        distro = hosts.get(hostname, username=args.username)
+        distro = hosts.get(
+            hostname,
+            username=args.username,
+            callbacks=[packages.ceph_is_installed]
+        )
         LOG.info(
             'Distro info: %s %s %s',
             distro.name,
@@ -444,7 +456,11 @@ def disk_zap(args):
 
 def disk_list(args, cfg):
     for hostname, disk, journal in args.disk:
-        distro = hosts.get(hostname, username=args.username)
+        distro = hosts.get(
+            hostname,
+            username=args.username,
+            callbacks=[packages.ceph_is_installed]
+        )
         LOG.info(
             'Distro info: %s %s %s',
             distro.name,
@@ -469,7 +485,12 @@ def osd_list(args, cfg):
 
     # get the osd tree from a monitor host
     mon_host = monitors[0]
-    distro = hosts.get(mon_host, username=args.username)
+    distro = hosts.get(
+        mon_host,
+        username=args.username,
+        callbacks=[packages.ceph_is_installed]
+    )
+
     tree = osd_tree(distro.conn, args.cluster)
     distro.conn.exit()