runtime: Use more folds in collect script

Improve the output of the data collection script to use lots more folds.
This makes it easier to review the information when viewing the pasted
output in a GitHub issue.

Fixes: #313.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
James O. D. Hunt 2020-06-12 11:40:30 +01:00
parent 9665868852
commit dee2cd67f2

View File

@ -212,16 +212,21 @@ run_cmd_and_show_quoted_output()
local output local output
msg "Output of \"\`$cmd\`\":"
output=$(eval "$cmd" 2>&1) output=$(eval "$cmd" 2>&1)
start_section "<tt>$cmd</tt>"
show_quoted_text "${language}" "$output" show_quoted_text "${language}" "$output"
end_section
} }
show_runtime_configs() show_runtime_configs()
{ {
local configs config local title="Runtime config files"
start_section "$title"
heading "Runtime config files" heading "$title"
local configs config
configs=$($runtime --@PROJECT_TYPE@-show-default-config-paths) configs=$($runtime --@PROJECT_TYPE@-show-default-config-paths)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
@ -253,6 +258,8 @@ show_runtime_configs()
done done
separator separator
end_section
} }
find_system_journal_problems() find_system_journal_problems()
@ -281,43 +288,63 @@ find_system_journal_problems()
show_containerd_shimv2_log_details() show_containerd_shimv2_log_details()
{ {
local name="Kata Containerd Shim v2" local title="Kata Containerd Shim v2"
subheading "$name logs" subheading "$title logs"
start_section "$title"
find_system_journal_problems "$name" "kata" find_system_journal_problems "$name" "kata"
end_section
} }
show_proxy_log_details() show_proxy_log_details()
{ {
subheading "Proxy logs" local title="Proxy logs"
subheading "$title"
start_section "$title"
find_system_journal_problems "proxy" "@PROJECT_TYPE@-proxy" find_system_journal_problems "proxy" "@PROJECT_TYPE@-proxy"
end_section
} }
show_runtime_log_details() show_runtime_log_details()
{ {
subheading "Runtime logs" local title="Runtime logs"
subheading "$title"
start_section "$title"
find_system_journal_problems "runtime" "@RUNTIME_NAME@" find_system_journal_problems "runtime" "@RUNTIME_NAME@"
end_section
} }
show_shim_log_details() show_shim_log_details()
{ {
subheading "Shim logs" local title="Shim logs"
subheading "$title"
start_section "$title"
find_system_journal_problems "shim" "@PROJECT_TYPE@-shim" find_system_journal_problems "shim" "@PROJECT_TYPE@-shim"
end_section
} }
show_throttler_log_details() show_throttler_log_details()
{ {
subheading "Throttler logs" local title="Throttler logs"
subheading "$title"
start_section "$title"
find_system_journal_problems "throttler" "@PROJECT_TYPE@-ksm-throttler" find_system_journal_problems "throttler" "@PROJECT_TYPE@-ksm-throttler"
end_section
} }
show_log_details() show_log_details()
{ {
heading "Logfiles" local title="Logfiles"
start_section "$title"
heading "$title"
show_runtime_log_details show_runtime_log_details
show_proxy_log_details show_proxy_log_details
@ -326,11 +353,17 @@ show_log_details()
show_containerd_shimv2_log_details show_containerd_shimv2_log_details
separator separator
end_section
} }
show_package_versions() show_package_versions()
{ {
heading "Packages" local title="Packages"
start_section "$title"
heading "$title"
local pattern="(" local pattern="("
local project local project
@ -368,47 +401,104 @@ show_package_versions()
fi fi
separator separator
end_section
} }
show_container_mgr_details() show_container_mgr_details()
{ {
heading "Container manager details" local title="Container manager details"
start_section "$title"
heading "$title"
if have_cmd "docker" >/dev/null; then
start_section "Docker"
if have_cmd "docker"; then
subheading "Docker" subheading "Docker"
run_cmd_and_show_quoted_output "" "docker version"
run_cmd_and_show_quoted_output "" "docker info" local -a cmds
run_cmd_and_show_quoted_output "" "systemctl show docker"
cmds+=("docker version")
cmds+=("docker info")
cmds+=("systemctl show docker")
local cmd
for cmd in "${cmds[@]}"
do
run_cmd_and_show_quoted_output "" "$cmd"
done
end_section
fi fi
if have_cmd "kubectl"; then if have_cmd "kubectl" >/dev/null; then
subheading "Kubernetes" title="Kubernetes"
start_section "$title"
subheading "$title"
run_cmd_and_show_quoted_output "" "kubectl version" run_cmd_and_show_quoted_output "" "kubectl version"
run_cmd_and_show_quoted_output "" "kubectl config view" run_cmd_and_show_quoted_output "" "kubectl config view"
run_cmd_and_show_quoted_output "" "systemctl show kubelet"
local cmd="systemctl show kubelet"
run_cmd_and_show_quoted_output "" "$cmd"
end_section
fi fi
if have_cmd "crio"; then if have_cmd "crio" >/dev/null; then
subheading "crio" title="crio"
start_section "$title"
subheading "$title"
run_cmd_and_show_quoted_output "" "crio --version" run_cmd_and_show_quoted_output "" "crio --version"
run_cmd_and_show_quoted_output "" "systemctl show crio"
run_cmd_and_show_quoted_output "" "cat /etc/crio/crio.conf" local cmd="systemctl show crio"
run_cmd_and_show_quoted_output "" "$cmd"
local file="/etc/crio/crio.conf"
cmd="cat $file"
run_cmd_and_show_quoted_output "" "$cmd"
end_section
fi fi
if have_cmd "containerd" >/dev/null; then
title="containerd"
start_section "$title"
subheading "$title"
if have_cmd "containerd"; then
subheading "containerd"
run_cmd_and_show_quoted_output "" "containerd --version" run_cmd_and_show_quoted_output "" "containerd --version"
run_cmd_and_show_quoted_output "" "systemctl show containerd"
run_cmd_and_show_quoted_output "" "cat /etc/containerd/config.toml" local cmd="systemctl show containerd"
run_cmd_and_show_quoted_output "" "$cmd"
local file="/etc/containerd/config.toml"
cmd="cat $file"
run_cmd_and_show_quoted_output "toml" "$cmd"
end_section
fi fi
if have_cmd "podman"; then if have_cmd "podman" >/dev/null; then
subheading "podman" title="Podman"
start_section "$title"
subheading "$title"
run_cmd_and_show_quoted_output "" "podman --version" run_cmd_and_show_quoted_output "" "podman --version"
end_section
fi fi
separator separator
end_section
} }
show_meta() show_meta()
@ -427,17 +517,25 @@ show_runtime()
{ {
local cmd local cmd
start_section "Runtime"
msg "Runtime is \`$runtime\`." msg "Runtime is \`$runtime\`."
cmd="@PROJECT_TYPE@-env" cmd="@PROJECT_TYPE@-env"
heading "\`$cmd\`" heading "\`$cmd\`"
run_cmd_and_show_quoted_output "toml" "$runtime $cmd" run_cmd_and_show_quoted_output "toml" "$runtime $cmd"
separator separator
end_section
} }
show_containerd_shimv2() show_containerd_shimv2()
{ {
start_section "Containerd shim v2"
local cmd="${containerd_shim_v2_name} --version" local cmd="${containerd_shim_v2_name} --version"
msg "Containerd shim v2 is \`$containerd_shim_v2\`." msg "Containerd shim v2 is \`$containerd_shim_v2\`."
@ -445,6 +543,8 @@ show_containerd_shimv2()
run_cmd_and_show_quoted_output "" "$cmd" run_cmd_and_show_quoted_output "" "$cmd"
separator separator
end_section
} }
# Parameter 1: Path to disk image file. # Parameter 1: Path to disk image file.
@ -644,6 +744,8 @@ release_device()
show_throttler_details() show_throttler_details()
{ {
start_section "KSM throttler"
heading "KSM throttler" heading "KSM throttler"
subheading "version" subheading "version"
@ -680,19 +782,24 @@ show_throttler_details()
have_service "${unit}" && \ have_service "${unit}" && \
run_cmd_and_show_quoted_output "" "systemctl show ${unit}" run_cmd_and_show_quoted_output "" "systemctl show ${unit}"
done done
end_section
} }
# Retrieve details of the image containing # Retrieve details of the image containing
# the rootfs used to boot the virtual machine. # the rootfs used to boot the virtual machine.
show_image_details() show_image_details()
{ {
local title="Image details"
start_section "$title"
heading "$title"
local image local image
local details local details
image=$(get_image_file) image=$(get_image_file)
heading "Image details"
if [ -n "$image" ] if [ -n "$image" ]
then then
details=$(get_image_details "$image") details=$(get_image_details "$image")
@ -702,12 +809,16 @@ show_image_details()
fi fi
separator separator
end_section
} }
# Retrieve details of the initrd containing # Retrieve details of the initrd containing
# the rootfs used to boot the virtual machine. # the rootfs used to boot the virtual machine.
show_initrd_details() show_initrd_details()
{ {
start_section "Initrd details"
local initrd local initrd
local details local details
@ -724,6 +835,8 @@ show_initrd_details()
fi fi
separator separator
end_section
} }
read_osbuilder_file() read_osbuilder_file()