From: Nikos Skalkotos Date: Fri, 9 Nov 2012 15:51:02 +0000 (+0200) Subject: Fix the error messages in helper X-Git-Tag: v0.7~23 X-Git-Url: https://code.grnet.gr/git/snf-image/commitdiff_plain/90db21517ad2424b692545b7b7f1fce25d808f07 Fix the error messages in helper --- diff --git a/snf-image-helper/common.sh b/snf-image-helper/common.sh index 92725c1..b9751ca 100644 --- a/snf-image-helper/common.sh +++ b/snf-image-helper/common.sh @@ -149,7 +149,7 @@ get_partition_table() { # secondary gpt is not it the end of the disk, and a warning that has to # do with the "Last Usable LBA" entry in gpt. if ! output="$("$PARTED" -s -m "$dev" unit s print | grep -E -v "^(Warning|Error): ")"; then - log_error "Unable to read partition table for device \`${dev}'" + log_error "Unable to read partition table for device \`${dev}'. The image seems corrupted." fi echo "$output" diff --git a/snf-image-helper/snf-image-helper.in b/snf-image-helper/snf-image-helper.in index c4f99d4..7b11bcb 100644 --- a/snf-image-helper/snf-image-helper.in +++ b/snf-image-helper/snf-image-helper.in @@ -90,6 +90,14 @@ trap '{ umount "$target"; }' ERR if [ -z "$SNF_IMAGE_PROPERTY_EXCLUDE_ALL_TASKS" ]; then + if [ "$SNF_IMAGE_PROPERTY_OSFAMILY" = "" ]; then + log_error "Required image property \`OSFAMILY' is missing or empty." + fi + + if [ "$SNF_IMAGE_PROPERTY_ROOT_PARTITION" = "" ]; then + log_error "Required image property \`ROOT_PARTITION' is missing or empty." + fi + export SNF_IMAGE_RESIZE_PART="$(get_partition_to_resize "$SNF_IMAGE_DEV")" if [[ ! "$SNF_IMAGE_PROPERTY_OSFAMILY" =~ ^(linux|windows)$ ]]; then diff --git a/snf-image-helper/tasks/30MountImage.in b/snf-image-helper/tasks/30MountImage.in index ba111ab..2474080 100644 --- a/snf-image-helper/tasks/30MountImage.in +++ b/snf-image-helper/tasks/30MountImage.in @@ -34,13 +34,15 @@ if [ ! -d "$SNF_IMAGE_TARGET" ]; then fi if [ -z "$SNF_IMAGE_PROPERTY_ROOT_PARTITION" ]; then - log_error "Root Partition image property not defined" + log_error "Required image property \`ROOT_PARTITION' not defined or empty" fi rootdev="${SNF_IMAGE_DEV}${SNF_IMAGE_PROPERTY_ROOT_PARTITION}" if [ ! -b "$rootdev" ]; then - log_error "Image root partition device:\`$rootdev' is not a block device" + log_error "Root partition device:\`$rootdev' is not a block device. " \ + "Please check if the value for image property \`ROOT_PARTITION' " \ + "(=$SNF_IMAGE_PROPERTY_ROOT_PARTITION) is valid." fi mount "$rootdev" "$SNF_IMAGE_TARGET" -o rw diff --git a/snf-image-helper/tasks/50ChangePassword.in b/snf-image-helper/tasks/50ChangePassword.in index 867dcac..5ef9fb6 100644 --- a/snf-image-helper/tasks/50ChangePassword.in +++ b/snf-image-helper/tasks/50ChangePassword.in @@ -40,6 +40,9 @@ windows_password() { echo "@echo off" > "$target/Windows/SnfScripts/ChangeAdminPassword.cmd" if [ -z "$SNF_IMAGE_PROPERTY_USERS" ]; then + warn "Image property \`USERS' is missing or empty. " \ + "Changing the password for default user: \`Administrator'." + SNF_IMAGE_PROPERTY_USERS="Administrator" fi @@ -67,6 +70,8 @@ linux_password() { users+=("$usr") done else + warn "Image property \`USERS' is missing or empty. " \ + "Changing the password for default user: \'root'." users+=("root") fi