]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
create the executable path helper
authorAlfredo Deza <alfredo.deza@inktank.com>
Tue, 8 Jul 2014 14:09:03 +0000 (10:09 -0400)
committerAlfredo Deza <alfredo.deza@inktank.com>
Tue, 8 Jul 2014 14:12:57 +0000 (10:12 -0400)
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
ceph_deploy/util/system.py [new file with mode: 0644]

diff --git a/ceph_deploy/util/system.py b/ceph_deploy/util/system.py
new file mode 100644 (file)
index 0000000..74e33c2
--- /dev/null
@@ -0,0 +1,15 @@
+from ceph_deploy.exc import ExecutableNotFound
+
+
+def executable_path(conn, executable):
+    """
+    Remote validator that accepts a connection object to ensure that a certain
+    executable is available returning its full path if so.
+
+    Otherwise an exception with thorough details will be raised, informing the
+    user that the executable was not found.
+    """
+    executable_path = conn.remote_module.which(executable)
+    if not executable_path:
+        raise ExecutableNotFound(executable, conn.hostname)
+    return executable_path