]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
[RM-11115] add a callback for checking if ceph is installed
authorAlfredo Deza <adeza@redhat.com>
Thu, 13 Aug 2015 12:29:46 +0000 (08:29 -0400)
committerAlfredo Deza <adeza@redhat.com>
Thu, 13 Aug 2015 12:31:52 +0000 (08:31 -0400)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
ceph_deploy/util/packages.py

index 3a1bea6cf11a6d82b999ad1ce97c5c7818d8389b..4c638040ad828ac6e419e12f68fe67cd75c8e22b 100644 (file)
@@ -57,3 +57,18 @@ class Ceph(object):
         :mod:``ceph_deploy.util.versions.NormalizedVersion``)
         """
         return versions.parse_version(self._get_version_output)
+
+
+# callback helpers
+
+def ceph_is_installed(module):
+    """
+    A helper callback to be executed after the connection is made to ensure
+    that Ceph is installed.
+    """
+    ceph_package = Ceph(module.conn)
+    if not ceph_package.installed:
+        host = module.conn.hostname
+        raise RuntimeError(
+            'ceph needs to be installed in remote host: %s' % host
+        )