Skip to content

Commit

Permalink
Temporary debugging for SOS gathering
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Akrog committed Nov 29, 2023
1 parent ea4c956 commit ea8098b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion collection-scripts/gather_edpm_sos
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down
3 changes: 2 additions & 1 deletion collection-scripts/gather_sos
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down

0 comments on commit ea8098b

Please sign in to comment.