scripts: Add helper function to collect script

Add a `have_service()` helper function to the data collection script to
simplify the code.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
James O. D. Hunt 2019-03-11 14:12:45 +00:00
parent 80cdf895c5
commit ae08ea3211

View File

@ -141,6 +141,13 @@ have_cmd()
[ $ret -eq 0 ]
}
have_service()
{
local service="$1"
systemctl status "${service}" >/dev/null 2>&1
}
show_quoted_text()
{
local language="$1"
@ -593,7 +600,7 @@ show_throttler_details()
"kata-vc-throttler" \
"vc-throttler"
do
systemctl status "${unit}" >/dev/null 2>&1 && \
have_service "${unit}" && \
run_cmd_and_show_quoted_output "" "systemctl show ${unit}"
done
}