aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Hasenack <andreas@mandriva.com>2006-08-18 22:07:45 +0000
committerAndreas Hasenack <andreas@mandriva.com>2006-08-18 22:07:45 +0000
commitb3201048cd9712325082d9c9d8db28e9636c39a6 (patch)
treed3496e2e53325488141b5b504e7e66402ec87724
parent15fda435aecb9cd96bd3ffd885315685b2d5753a (diff)
downloadmgarepo-b3201048cd9712325082d9c9d8db28e9636c39a6.tar
mgarepo-b3201048cd9712325082d9c9d8db28e9636c39a6.tar.gz
mgarepo-b3201048cd9712325082d9c9d8db28e9636c39a6.tar.bz2
mgarepo-b3201048cd9712325082d9c9d8db28e9636c39a6.tar.xz
mgarepo-b3201048cd9712325082d9c9d8db28e9636c39a6.zip
- ups, forgot get_helper
-rw-r--r--RepSys/util.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/RepSys/util.py b/RepSys/util.py
index 766d3c1..5612029 100644
--- a/RepSys/util.py
+++ b/RepSys/util.py
@@ -51,4 +51,18 @@ def get_auth(username=None, password=None):
config.set("auth", "password", password)
return username, password
+def get_helper(name):
+ """Tries to find the path of a helper script
+
+ It first looks if the helper has been explicitly defined in
+ configuration, if not, falls back to the default helper path, which can
+ also be defined in configuration file(s).
+ """
+ helperdir = config.get("helper", "prefix", "/usr/share/repsys")
+ hpath = config.get("helper", name, None) or \
+ os.path.join(helperdir, name)
+ if not os.path.isfile(hpath):
+ log.warn("providing unexistent helper: %s", hpath)
+ return hpath
+
# vim:et:ts=4:sw=4