From ea8098be9633454faff4bbee476e99acd54fc378 Mon Sep 17 00:00:00 2001 From: Gorka Eguileor Date: Wed, 29 Nov 2023 11:33:22 +0100 Subject: [PATCH] Temporary debugging for SOS gathering This patch adds a `tee` command to the download and decompression pipe in the gather_sos and gather_edpm_sos scripts. By writing the output of cat and the input of tar into a file we can see what it got on failure. --- collection-scripts/gather_edpm_sos | 3 ++- collection-scripts/gather_sos | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/collection-scripts/gather_edpm_sos b/collection-scripts/gather_edpm_sos index 61fdc5e..3a8e60e 100755 --- a/collection-scripts/gather_edpm_sos +++ b/collection-scripts/gather_edpm_sos @@ -74,13 +74,14 @@ gather_edpm_sos () { echo "Retrieving SOS Report for ${node}" mkdir -p "${SOS_PATH_NODES}/sosreport-$node" - SSH sudo "cat ${TMPDIR}/*.tar.xz" | tar --one-top-level="${SOS_PATH_NODES}/sosreport-$node" --strip-components=1 --exclude='*/dev/null' -Jxf - + SSH sudo "cat ${TMPDIR}/*.tar.xz" | tee "${SOS_PATH_NODES}/sosreport-$node.tar.xz" | tar --one-top-level="${SOS_PATH_NODES}/sosreport-$node" --strip-components=1 --exclude='*/dev/null' -Jxf - # shellcheck disable=SC2181 if [ $? -ne 0 ]; then echo "Failed to download and decompress sosreport-$node.tar.xz not deleting file" return 1 fi + rm "${SOS_PATH_NODES}/sosreport-$node.tar.xz" # Ensure write access to the sos reports directories so must-gather rsync doesn't fail chmod +w -R "${SOS_PATH_NODES}/sosreport-$node/" diff --git a/collection-scripts/gather_sos b/collection-scripts/gather_sos index deb8b22..4591897 100755 --- a/collection-scripts/gather_sos +++ b/collection-scripts/gather_sos @@ -91,13 +91,14 @@ gather_node_sos () { echo "Retrieving SOS Report for ${node}" mkdir "${SOS_PATH_NODES}/sosreport-$node" # Add "--loglevel 6" to help debug in case there's a failure - oc debug --loglevel 6 "node/$node" -- cat "/host${TMPDIR}/*.tar.xz" | tar --one-top-level="${SOS_PATH_NODES}/sosreport-$node" --strip-components=1 --exclude='*/dev/null' -Jxf - + oc debug --loglevel 6 "node/$node" -- cat "/host${TMPDIR}/*.tar.xz" | tee "${SOS_PATH_NODES}/sosreport-$node.tar.xz" | tar --one-top-level="${SOS_PATH_NODES}/sosreport-$node" --strip-components=1 --exclude='*/dev/null' -Jxf - # shellcheck disable=SC2181 if [ $? -ne 0 ]; then echo "Failed to download and decompress sosreport-$node.tar.xz not deleting file" return 1 fi + rm "${SOS_PATH_NODES}/sosreport-$node.tar.xz" # Ensure write access to the sos reports directories so must-gather rsync doesn't fail chmod +w -R "${SOS_PATH_NODES}/sosreport-$node/"