Skip to content

Commit

Permalink
inspect.sh: avoid logging an error if there are no core dumps
Browse files Browse the repository at this point in the history
The inspect.sh script will log an error if the core dump dir
is empty. We'll add a check to improve the user experience.

   INFO:  Copy dmesg entries
   INFO:  Collecting core dumps from /var/crash. Size: 4.0K    /var/crash
   cp: cannot stat '/var/crash/*': No such file or directory
   Collecting snap and related information
  • Loading branch information
petrutlucian94 committed Jan 31, 2025
1 parent c24d820 commit 4e25b40
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions k8s/scripts/inspect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,12 @@ function collect_registry_mirror_logs {

function collect_core_dumps {
mkdir -p "$INSPECT_DUMP/core_dumps"
if [[ -d $CORE_DUMP_DIR ]]; then
if [[ -d $CORE_DUMP_DIR && ! -z `ls -A $CORE_DUMP_DIR` ]]; then
local dump_dir_size=`du -sh $CORE_DUMP_DIR`
log_info "Collecting core dumps from $CORE_DUMP_DIR. Size: $dump_dir_size"
cp $CORE_DUMP_DIR/* "$INSPECT_DUMP/core_dumps/"
else
log_info "Core dump directory missing, skipping..."
log_info "Core dump directory empty or missing, skipping..."
fi
}

Expand Down

0 comments on commit 4e25b40

Please sign in to comment.