Fix the error messages in helper
authorNikos Skalkotos <skalkoto@grnet.gr>
Fri, 9 Nov 2012 15:51:02 +0000 (17:51 +0200)
committerNikos Skalkotos <skalkoto@grnet.gr>
Tue, 13 Nov 2012 13:16:03 +0000 (15:16 +0200)
snf-image-helper/common.sh
snf-image-helper/snf-image-helper.in
snf-image-helper/tasks/30MountImage.in
snf-image-helper/tasks/50ChangePassword.in

index 92725c1..b9751ca 100644 (file)
@@ -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"
index c4f99d4..7b11bcb 100644 (file)
@@ -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
index ba111ab..2474080 100644 (file)
@@ -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
index 867dcac..5ef9fb6 100644 (file)
@@ -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