From fa444a00d7b5c79e276cc2086e5544be649f8247 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Fri, 14 Sep 2012 23:03:42 +0200 Subject: [PATCH] bug #1245: Fix generation of driver filenames for one_im_exec and one_vmm_exec nbased drivers. --- src/im_mad/im_exec/one_im_exec | 4 +--- src/im_mad/im_exec/one_im_sh | 2 ++ src/im_mad/im_exec/one_im_ssh | 2 ++ src/mad/sh/madcommon.sh | 10 +++++----- src/vmm_mad/exec/one_vmm_exec | 2 ++ 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/im_mad/im_exec/one_im_exec b/src/im_mad/im_exec/one_im_exec index 1520312ca5..9e73f5990e 100755 --- a/src/im_mad/im_exec/one_im_exec +++ b/src/im_mad/im_exec/one_im_exec @@ -17,8 +17,6 @@ #--------------------------------------------------------------------------- # #Setup driver variables -DRIVER_NAME=`basename $0 | cut -d. -f1` - if [ -z "${ONE_LOCATION}" ]; then DRIVERRC=/etc/one/${DRIVER_NAME}/${DRIVER_NAME}rc MADCOMMON=/usr/lib/one/mads/madcommon.sh @@ -38,7 +36,7 @@ export_rc_vars $DRIVERRC # Go to var directory ONE_LOCATION/var or /var/lib/one cd $VAR_LOCATION -LOG_FILE=one_im_ssh_$DRIVER_NAME +LOG_FILE=$DRIVER_NAME # Execute the actual MAD execute_mad $* diff --git a/src/im_mad/im_exec/one_im_sh b/src/im_mad/im_exec/one_im_sh index 6c1f201271..8ff231bca3 100755 --- a/src/im_mad/im_exec/one_im_sh +++ b/src/im_mad/im_exec/one_im_sh @@ -22,4 +22,6 @@ else MAD_LOCATION=$ONE_LOCATION/lib/mads fi +export DRIVER_NAME="one_im_sh_${BASH_ARGV##* }" + exec $MAD_LOCATION/one_im_exec -l $* diff --git a/src/im_mad/im_exec/one_im_ssh b/src/im_mad/im_exec/one_im_ssh index 25b6a2f58d..2a7fe3f17d 100755 --- a/src/im_mad/im_exec/one_im_ssh +++ b/src/im_mad/im_exec/one_im_ssh @@ -22,4 +22,6 @@ else MAD_LOCATION=$ONE_LOCATION/lib/mads fi +export DRIVER_NAME="one_im_ssh_${BASH_ARGV##* }" + exec $MAD_LOCATION/one_im_exec $* diff --git a/src/mad/sh/madcommon.sh b/src/mad/sh/madcommon.sh index 3674dc5103..5ac13551a2 100644 --- a/src/mad/sh/madcommon.sh +++ b/src/mad/sh/madcommon.sh @@ -14,14 +14,14 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -function mad_debug +function mad_debug { if [ -n "${ONE_MAD_DEBUG}" ]; then ulimit -c 15000 fi } -function export_rc_vars +function export_rc_vars { if [ -f $1 ] ; then ONE_VARS=`cat $1 | egrep -e '^[a-zA-Z\-\_0-9]*=' | sed 's/=.*$//'` @@ -38,17 +38,17 @@ function execute_mad { MAD_FILE=`basename $0` - + if [ -z "$LOG_FILE" ]; then LOG_FILE=$MAD_FILE fi if [ -z "${ONE_LOCATION}" ]; then MAD_EXEC_PATH=/usr/lib/one/mads/$MAD_FILE.rb - MAD_LOG_PATH=/var/log/one/$LOG_FILE.log + MAD_LOG_PATH=/var/log/one/$LOG_FILE.log else MAD_EXEC_PATH=$ONE_LOCATION/lib/mads/$MAD_FILE.rb - MAD_LOG_PATH=$ONE_LOCATION/var/$LOG_FILE.log + MAD_LOG_PATH=$ONE_LOCATION/var/$LOG_FILE.log fi if [ -n "${ONE_MAD_DEBUG}" ]; then diff --git a/src/vmm_mad/exec/one_vmm_exec b/src/vmm_mad/exec/one_vmm_exec index 3246945e5c..004f93135f 100755 --- a/src/vmm_mad/exec/one_vmm_exec +++ b/src/vmm_mad/exec/one_vmm_exec @@ -34,5 +34,7 @@ export_rc_vars $DRIVERRC # Go to ONE_LOCATION cd $VAR_LOCATION +LOG_FILE=one_vmm_${BASH_ARGV##* } + # Execute the actual MAD execute_mad $*