diff options
| author | Simon Rettberg | 2016-02-25 15:50:05 +0100 |
|---|---|---|
| committer | Simon Rettberg | 2016-02-25 15:50:05 +0100 |
| commit | 833a395e15df435f1ee034cb3feb994575f428da (patch) | |
| tree | 8033787c5e5e374f42c2b23360c76228bbc56603 /remote/modules/run-virt | |
| parent | [run-virt] Better error checking/logging for dnbd3-fuse (diff) | |
| download | tm-scripts-833a395e15df435f1ee034cb3feb994575f428da.tar.gz tm-scripts-833a395e15df435f1ee034cb3feb994575f428da.tar.xz tm-scripts-833a395e15df435f1ee034cb3feb994575f428da.zip | |
[run-virt] Don't writelog to stdout if usb device listing fails
Diffstat (limited to 'remote/modules/run-virt')
| -rw-r--r-- | remote/modules/run-virt/data/opt/openslx/scripts/includes/usb_detector.inc | 8 | ||||
| -rw-r--r-- | remote/modules/run-virt/data/opt/openslx/scripts/includes/vmchooser_runvirt_functions.inc | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/remote/modules/run-virt/data/opt/openslx/scripts/includes/usb_detector.inc b/remote/modules/run-virt/data/opt/openslx/scripts/includes/usb_detector.inc index 43a75b2a..9769c81d 100644 --- a/remote/modules/run-virt/data/opt/openslx/scripts/includes/usb_detector.inc +++ b/remote/modules/run-virt/data/opt/openslx/scripts/includes/usb_detector.inc @@ -14,11 +14,11 @@ get_usb_devices_int() { local EXP=$1 shift if [ -z "$EXP" ]; then - writelog "No ouput expression template passed to get_usb_devices" + writelog --quiet "No ouput expression template passed to get_usb_devices" cleanexit 1 fi if [ $# -eq 0 ]; then - writelog "No device classes given to get_usb_devices" + writelog --quiet "No device classes given to get_usb_devices" cleanexit 1 fi local MATCH=';' @@ -33,7 +33,7 @@ get_usb_devices_int() { local tmp="${TMPDIR}/lsusb.$$.$RANDOM" for dev in /dev/bus/usb/*/*; do if ! lsusb -D "$dev" > "$tmp" 2>/dev/null; then - writelog "Cannot lsusb $dev" + writelog --quiet "Cannot lsusb $dev" continue fi local DC= @@ -71,7 +71,7 @@ get_usb_devices() { [ $# -eq 1 ] && set -- "$1" $PASSTHROUGH_USB_DEVICES # no quotes here! get_usb_devices_int "$@" | sort -u else - writelog "Cannot scan usb bus: lsusb not found or doesn't support -D" + writelog --quiet "Cannot scan usb bus: lsusb not found or doesn't support -D" fi } diff --git a/remote/modules/run-virt/data/opt/openslx/scripts/includes/vmchooser_runvirt_functions.inc b/remote/modules/run-virt/data/opt/openslx/scripts/includes/vmchooser_runvirt_functions.inc index b85bb32c..1f09b3d2 100644 --- a/remote/modules/run-virt/data/opt/openslx/scripts/includes/vmchooser_runvirt_functions.inc +++ b/remote/modules/run-virt/data/opt/openslx/scripts/includes/vmchooser_runvirt_functions.inc @@ -5,8 +5,12 @@ # function to write to stdout and logfile writelog() { local DATE=$(date +%Y-%m-%d-%H-%M-%S) - # write to stdout - echo -e "$DATE: $@" + # write to stdout? + if [ "x$1" = "x--quiet" ]; then + shift + else + echo -e "$DATE: $@" + fi # log into file echo -e "$DATE: $@" >> "${LOGFILE}" } |
