Move the task exclusion check away from common.sh
authorNikos Skalkotos <skalkoto@grnet.gr>
Tue, 13 Dec 2011 10:54:45 +0000 (12:54 +0200)
committerNikos Skalkotos <skalkoto@grnet.gr>
Tue, 13 Dec 2011 11:52:32 +0000 (13:52 +0200)
Not all tasks, should be able to be excluded. If MountImage,
UnmountImage and InstallUnattanded are never excluded, then the system
deployment can't break. If you don't want to mount the image or install
Unattend.xml then you probably want to use EXCLUDE_ALL_TASKS, since all
other tasks depend on the aforementioned ones.

snf-image-helper/common.sh
snf-image-helper/tasks/10FixPartitionTable.in
snf-image-helper/tasks/20FilesystemResizeUnmounted.in
snf-image-helper/tasks/40DeleteSSHKeys.in
snf-image-helper/tasks/40DisableRemoteDesktopConnections.in
snf-image-helper/tasks/40SELinuxAutorelabel.in
snf-image-helper/tasks/50AssignHostname.in
snf-image-helper/tasks/50ChangePassword.in
snf-image-helper/tasks/50EnforcePersonality.in
snf-image-helper/tasks/50FilesystemResizeMounted.in

index 484b260..5758775 100644 (file)
@@ -153,8 +153,6 @@ cleanup() {
 
 check_if_excluded() {
 
-    test "$PROGNAME" = "snf-image-helper" && return 0
-
     local exclude=SNF_IMAGE_PROPERTY_EXCLUDE_TASK_${PROGNAME:2}
     if [ -n "${!exclude}" ]; then
         warn "Task $PROGNAME was excluded and will not run."
@@ -166,7 +164,4 @@ check_if_excluded() {
 
 trap cleanup EXIT
 
-# Check if the execution of a task should be ommited
-check_if_excluded
-
 # vim: set sta sts=4 shiftwidth=4 sw=4 et ai :
index 5b499c8..b9d8f6a 100644 (file)
@@ -26,6 +26,9 @@
 set -e
 . "@commondir@/common.sh"
 
+# Check if the task should be prevented from running.
+check_if_excluded
+
 if [ ! -b "$SNF_IMAGE_DEV" ]; then
     log_error "Device file:\`${SNF_IMAGE_DEV}' is not a block device"
 fi
index 165eb41..f5fef0c 100644 (file)
@@ -27,6 +27,9 @@
 set -e
 . "@commondir@/common.sh"
 
+# Check if the task should be prevented from running.
+check_if_excluded
+
 if [ ! -b "$SNF_IMAGE_DEV" ]; then
     log_error "Device file:\`${SNF_IMAGE_DEV}' is not a block device"
 fi
index 3374706..a71027d 100644 (file)
@@ -27,6 +27,9 @@
 set -e
 . "@commondir@/common.sh"
 
+# Check if the task should be prevented from running.
+check_if_excluded
+
 if [ ! -d "$SNF_IMAGE_TARGET" ]; then
     log_error "Target dir: \`$SNF_IMAGE_TARGET' is missing."
 fi
index 027799a..59faa3e 100644 (file)
@@ -34,6 +34,9 @@
 set -e
 . "@commondir@/common.sh"
 
+# Check if the task should be prevented from running.
+check_if_excluded
+
 if [ ! -d "$SNF_IMAGE_TARGET" ]; then
     log_error "Target directory \`$SNF_IMAGE_TARGET' is missing"
 fi
index a831918..9eedfa0 100644 (file)
@@ -27,6 +27,9 @@
 set -e
 . "@commondir@/common.sh"
 
+# Check if the task should be prevented from running.
+check_if_excluded
+
 if [ ! -d "$SNF_IMAGE_TARGET" ]; then
        log_error "Target dir: \`$SNF_IMAGE_TARGET' is missing" 
 fi
index 4b879bf..a944c49 100644 (file)
@@ -27,6 +27,9 @@
 set -e
 . "@commondir@/common.sh"
 
+# Check if the task should be prevented from running.
+check_if_excluded
+
 windows_hostname() {
     local target="$1"
     local password="$2"
index d6f3771..58caafd 100644 (file)
@@ -27,6 +27,9 @@
 set -e
 . "@commondir@/common.sh"
 
+# Check if the task should be prevented from running.
+check_if_excluded
+
 windows_password() {
     local target="$1"
     local password="$2"
index dcac055..79c7437 100644 (file)
@@ -29,6 +29,9 @@ set -o pipefail
 
 . "@commondir@/common.sh"
 
+# Check if the task should be prevented from running.
+check_if_excluded
+
 if [ ! -d "$SNF_IMAGE_TARGET" ]; then
     log_error "Target dir: \`$SNF_IMAGE_TARGET' is missing"
 fi
index 7ff3c1d..db382c9 100644 (file)
@@ -27,6 +27,9 @@
 set -e
 . "@commondir@/common.sh"
 
+# Check if the task should be prevented from running.
+check_if_excluded
+
 if [ ! -d "$SNF_IMAGE_TARGET" ]; then
     log_error "Target directory \`$SNF_IMAGE_TARGET' is missing"
 fi