Skip to content

Commit

Permalink
Improve error reporting for remote deployment
Browse files Browse the repository at this point in the history
Add new method called show_log_and_quit which displays
the written error log file as a file box to the user
  • Loading branch information
schaefi committed Aug 8, 2024
1 parent ba57964 commit 60ecd58
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
16 changes: 8 additions & 8 deletions dracut/modules.d/90kiwi-dump/kiwi-dump-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -387,25 +387,25 @@ function get_remote_image_source_files {
echo "--- ip a ---"; ip a
echo "--- ip r ---"; ip r
} >> /tmp/fetch.info 2>&1
report_and_quit \
"Failed to fetch ${image_md5_uri}, see /tmp/fetch.info"
show_log_and_quit \
"Failed to fetch ${image_md5_uri}" /tmp/fetch.info
fi

if ! fetch_file "${image_kernel_uri}" > "${metadata_dir}/linux";then
report_and_quit \
"Failed to fetch ${image_kernel_uri}, see /tmp/fetch.info"
show_log_and_quit \
"Failed to fetch ${image_kernel_uri}" /tmp/fetch.info
fi

if ! fetch_file "${image_initrd_uri}" > "${install_dir}/initrd.system_image"
then
report_and_quit \
"Failed to fetch ${image_initrd_uri}, see /tmp/fetch.info"
show_log_and_quit \
"Failed to fetch ${image_initrd_uri}" /tmp/fetch.info
fi

if ! fetch_file "${image_config_uri}" > "/config.bootoptions"
then
report_and_quit \
"Failed to fetch ${image_config_uri}, see /tmp/fetch.info"
show_log_and_quit \
"Failed to fetch ${image_config_uri}" /tmp/fetch.info
fi

echo "${image_uri}|${image_md5}"
Expand Down
12 changes: 12 additions & 0 deletions dracut/modules.d/99kiwi-lib/kiwi-dialog-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,18 @@ function _fbiterm_ok {
return 0
}

function show_log_and_quit {
local text_message="$1"
local log_file="$2"
run_dialog --timeout 60 --backtitle "\"${text_message}\"" \
--textbox "${log_file}" 15 80
if getargbool 0 rd.debug; then
die "${text_message}"
else
reboot -f
fi
}

function report_and_quit {
local text_message="$1"
run_dialog --timeout 60 --msgbox "\"${text_message}\"" 5 80
Expand Down

0 comments on commit 60ecd58

Please sign in to comment.