mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
ctdb-tools: Simplify "ctdb getdebug" output format
Print just the debug level as a description, for both human and machine readable. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
4af127cc37
commit
b6623feb9c
@ -36,7 +36,7 @@ getdebug_onnode="$out"
|
||||
|
||||
sanity_check_output \
|
||||
$num_nodes \
|
||||
'^Node [[:digit:]]+ is at debug level [[:alpha:]]+ \([[:digit:]]+\)$' \
|
||||
'^(ERROR|WARNING|NOTICE|INFO|DEBUG)$' \
|
||||
"$out"
|
||||
|
||||
cmd=""
|
||||
@ -62,15 +62,3 @@ while read line ; do
|
||||
t=$(echo "$line" | sed -r -e 's@Node [[:digit:]]+ is at debug level ([[:alpha:]]+) \((-?[[:digit:]]+)\)$@\|\1\|\2|@')
|
||||
seps="${seps}${seps:+${nl}}|Name|Level|${nl}${t}"
|
||||
done <<<"$getdebug_onnode"
|
||||
|
||||
cmd="onnode -q all $CTDB -X getdebug"
|
||||
echo "Checking that \"$cmd\" produces expected output..."
|
||||
|
||||
try_command_on_node 1 "$cmd"
|
||||
if [ "$out" = "$seps" ] ; then
|
||||
echo "Yep, looks good!"
|
||||
else
|
||||
echo "Nope, it looks like this:"
|
||||
echo "$out"
|
||||
testfailures=1
|
||||
fi
|
||||
|
@ -27,10 +27,9 @@ get_debug ()
|
||||
local node="$1"
|
||||
|
||||
local out
|
||||
|
||||
|
||||
try_command_on_node -v $node "$CTDB getdebug"
|
||||
check_debug=$(echo "$out" |
|
||||
sed -r -e 's@Node [[:digit:]]+ is at debug level ([[:alpha:]]+) \(-?[[:digit:]]+\)$@\1@')
|
||||
check_debug="$out"
|
||||
}
|
||||
|
||||
set_and_check_debug ()
|
||||
|
@ -4184,13 +4184,7 @@ static int control_getdebug(struct ctdb_context *ctdb, int argc, const char **ar
|
||||
/* This should never happen */
|
||||
desc = "Unknown";
|
||||
}
|
||||
if (options.machinereadable){
|
||||
printm(":Name:Level:\n");
|
||||
printm(":%s:%d:\n", desc, level);
|
||||
} else {
|
||||
printf("Node %u is at debug level %s (%d)\n",
|
||||
options.pnn, desc, level);
|
||||
}
|
||||
printf("%s\n", desc);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user