Commit 27b7f907 authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Implement EXCLUDE_MOUNTED_TASKS image property

If this property is defined, then only the tasks that are meant to run
before the VM's disk gets mounted (namely FixPartitionTable and
FilesystemResizeUmounted) will be allowed to run during deployment.

This resolves #77
parent b68c2351
......@@ -197,6 +197,11 @@ All image formats properties
because it gives the ability to deploy images hosting operating systems
whose configuration is not supported by *snf-image*.
* **EXCLUDE_MOUNTED_TASKS=yes**
If this property is defined, then only the tasks that are meant to run
before the VM's disk gets mounted (namely *FixPartitionTable* and
*FilesystemResizeUmounted*) will be allowed to run during deployment.
* **EXCLUDE_TASK_<task_name>=yes**
This family of properties gives the ability to exclude individual
configuration tasks from running. Hence, if the property
......
......@@ -851,6 +851,15 @@ check_if_excluded() {
return 0
}
check_if_mounted_excluded() {
if [ -n "$SNF_IMAGE_PROPERTY_EXCLUDE_MOUNTED_TASKS" ]; then
warn "Task ${PROGNAME:2} was excluded and will not run."
exit 0
fi
return 0
}
return_success() {
send_result_${HYPERVISOR} "SUCCESS"
}
......
......@@ -29,6 +29,9 @@ set -e
trap task_cleanup EXIT
report_task_start
# Check if the task should be prevented from running
check_if_mounted_excluded
if [ ! -d "$SNF_IMAGE_TARGET" ]; then
log_error "Target dir:\`$SNF_IMAGE_TARGET' is missing"
fi
......
......@@ -32,6 +32,7 @@ report_task_start
# Check if the task should be prevented from running.
check_if_excluded
check_if_mounted_excluded
if [ ! -d "$SNF_IMAGE_TARGET" ]; then
log_error "Target dir: \`$SNF_IMAGE_TARGET' is missing."
......
......@@ -32,6 +32,7 @@ report_task_start
# Check if the task should be prevented from running.
check_if_excluded
check_if_mounted_excluded
if [ ! -d "$SNF_IMAGE_TARGET" ]; then
log_error "Target dir: \`$SNF_IMAGE_TARGET' is missing."
......
......@@ -39,6 +39,7 @@ report_task_start
# Check if the task should be prevented from running.
check_if_excluded
check_if_mounted_excluded
if [ ! -d "$SNF_IMAGE_TARGET" ]; then
log_error "Target directory \`$SNF_IMAGE_TARGET' is missing"
......
......@@ -30,6 +30,9 @@ set -e
trap task_cleanup EXIT
report_task_start
# Check if the task should be prevented from running.
check_if_mounted_excluded
if [ -z "$SNF_IMAGE_TARGET" ]; then
log_error "Target dir: \`$SNF_IMAGE_TARGET' is missing"
fi
......
......@@ -30,6 +30,9 @@ set -e
trap task_cleanup EXIT
report_task_start
# Check if the task should be prevented from running
check_if_mounted_excluded
# Check if the task should be prevented from running.
check_if_excluded
......
......@@ -32,6 +32,7 @@ report_task_start
# Check if the task should be prevented from running.
check_if_excluded
check_if_mounted_excluded
windows_hostname() {
local target password unattend tmp_unattend namespace
......
......@@ -32,6 +32,7 @@ report_task_start
# Check if the task should be prevented from running.
check_if_excluded
check_if_mounted_excluded
linux_shadow="/etc/shadow"
freebsd_shadow="/etc/master.passwd"
......
......@@ -33,6 +33,7 @@ report_task_start
# Check if the task should be prevented from running.
check_if_excluded
check_if_mounted_excluded
if [ ! -d "$SNF_IMAGE_TARGET" ]; then
log_error "Target dir: \`$SNF_IMAGE_TARGET' is missing"
......
......@@ -32,6 +32,7 @@ report_task_start
# Check if the task should be prevented from running.
check_if_excluded
check_if_mounted_excluded
if [ ! -b "$SNF_IMAGE_DEV" ]; then
log_error "Device file:\`${SNF_IMAGE_DEV}' is not a block device"
......
......@@ -33,6 +33,7 @@ report_task_start
# Check if the task should be prevented from running.
check_if_excluded
check_if_mounted_excluded
# Default mode for directories
DIRMODE="750"
......
......@@ -30,6 +30,9 @@ set -e
trap task_cleanup EXIT
report_task_start
# Check if the task should be prevented from running
check_if_mounted_excluded
if [ ! -d "$SNF_IMAGE_TARGET" ]; then
log_error "Target dir:\`$SNF_IMAGE_TARGET' is missing"
fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment