From: Alfredo Deza Date: Tue, 8 Jul 2014 14:09:03 +0000 (-0400) Subject: create the executable path helper X-Git-Tag: v1.5.8~5^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c1b118a5f2ff4c3e45233377ec348a635c9552a1;p=ceph-deploy.git create the executable path helper Signed-off-by: Alfredo Deza --- diff --git a/ceph_deploy/util/system.py b/ceph_deploy/util/system.py new file mode 100644 index 0000000..74e33c2 --- /dev/null +++ b/ceph_deploy/util/system.py @@ -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