From 3472a07461619c3397c8ca434f00e7946bf608ea Mon Sep 17 00:00:00 2001 From: Goffi Date: Mon, 6 Jun 2011 18:34:40 +0200 Subject: [PATCH] core: local_dir can now be overrided (usefull to launch 2 instances at the same time) --- src/core/sat_main.py | 7 +++++++ src/sat.sh | 10 ++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/core/sat_main.py b/src/core/sat_main.py index 88b664d1..0319e9ba 100644 --- a/src/core/sat_main.py +++ b/src/core/sat_main.py @@ -75,6 +75,13 @@ class SAT(service.Service): def get_const(self, name): """Return a constant""" + try: + _const = os.environ['SAT_CONST_%s' % name] + if _const: + debug(_("Constant %(name)s overrided with [%(value)s]") % {'name':name, 'value': _const}) + return _const + except KeyError: + pass if not CONST.has_key(name): error(_('Trying to access an undefined constant')) raise Exception diff --git a/src/sat.sh b/src/sat.sh index 55d0f407..51601b9f 100755 --- a/src/sat.sh +++ b/src/sat.sh @@ -16,8 +16,14 @@ fi NAME='sat' -PID_FILE="/tmp/$NAME.pid" -LOG_FILE=~/".$NAME/$NAME.log" +if [ -n "$SAT_CONST_local_dir" ];then + echo "Using overidded local dir: $SAT_CONST_local_dir" + PID_FILE="$SAT_CONST_local_dir/$NAME.pid" + LOG_FILE="$SAT_CONST_local_dir/$NAME.log" +else + PID_FILE="/tmp/$NAME.pid" + LOG_FILE=~/".$NAME/$NAME.log" +fi DAEMON="n" MAIN_OPTIONS="-${DAEMON}oy" TAP_PATH="./"