From 4d2d1fb94b52f9a64e0a35ae23caef6769ac57b4 Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Wed, 1 Aug 2018 23:51:50 +0200 Subject: [PATCH] Plugins xen_*: fix 'autoconf' logic and exitcode --- plugins/xen/xen_memory | 8 ++++---- plugins/xen/xen_traffic_ | 13 +++++-------- plugins/xen/xen_traffic_all | 13 +++++-------- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/plugins/xen/xen_memory b/plugins/xen/xen_memory index f42f0919..c9e217e5 100755 --- a/plugins/xen/xen_memory +++ b/plugins/xen/xen_memory @@ -15,12 +15,12 @@ XM='/usr/sbin/xm' if [ "$1" = "autoconf" ]; then - if [ -e $XM ]; then + if [ -x "$XM" ]; then echo yes - exit 0 + else + echo "no (xm not found)" fi - echo "no (xm not found)" - exit 1 + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/xen/xen_traffic_ b/plugins/xen/xen_traffic_ index 454b2209..57e96a52 100755 --- a/plugins/xen/xen_traffic_ +++ b/plugins/xen/xen_traffic_ @@ -12,16 +12,13 @@ NAME=$( echo "$DOMAIN" | sed -e's/-/_/g' ) if [ "$1" = "autoconf" ]; then if which xm > /dev/null ; then - echo yes + if [ -r /proc/net/dev ]; then + echo yes + else + echo "no (/proc/net/dev not found)" + fi else echo "no (xm not found)" - exit 1 - fi - if [ -r /proc/net/dev ]; then - echo yes - else - echo "no (/proc/net/dev not found)" - exit 1 fi exit 0 fi diff --git a/plugins/xen/xen_traffic_all b/plugins/xen/xen_traffic_all index dc9ac47f..7c5fa3d2 100755 --- a/plugins/xen/xen_traffic_all +++ b/plugins/xen/xen_traffic_all @@ -11,16 +11,13 @@ if [ "$1" = "autoconf" ]; then if which xm > /dev/null ; then - echo yes + if [ -r /proc/net/dev ]; then + echo yes + else + echo "no (/proc/net/dev not found)" + fi else echo "no (xm not found)" - exit 1 - fi - if [ -r /proc/net/dev ]; then - echo yes - else - echo "no (/proc/net/dev not found)" - exit 1 fi exit 0 fi