mirror of
https://github.com/hackacad/bastille.git
synced 2025-12-18 16:21:32 +01:00
Add some checks wen handling batch snapshots
Add some checks and delay only wen handling batch snapshots with generated names.
This commit is contained in:
@@ -58,6 +58,7 @@ SNAP_CREATE=
|
|||||||
SNAP_ROLLBACK=
|
SNAP_ROLLBACK=
|
||||||
SNAP_DESTROY=
|
SNAP_DESTROY=
|
||||||
SNAP_VERBOSE=
|
SNAP_VERBOSE=
|
||||||
|
SNAP_CHECK=
|
||||||
SNAP_BATCH=
|
SNAP_BATCH=
|
||||||
|
|
||||||
zfs_jail_dataset() {
|
zfs_jail_dataset() {
|
||||||
@@ -241,6 +242,13 @@ snapshot_checks() {
|
|||||||
SNAPSHOT_NAME="Bastille_${NAME_MD5X6}_${_JAIL}_${DATE}"
|
SNAPSHOT_NAME="Bastille_${NAME_MD5X6}_${_JAIL}_${DATE}"
|
||||||
TAG="${SNAPSHOT_NAME}"
|
TAG="${SNAPSHOT_NAME}"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Check for the generated snapshot name.
|
||||||
|
SNAP_CHECK=$(echo ${TAG} | grep -wo "Bastille_[0-9a-fA-F]\{6\}_${_jail}_[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}-[0-9]\{6\}")
|
||||||
|
if [ -z "${SNAP_CHECK}" ]; then
|
||||||
|
info "\n[${_jail}]:"
|
||||||
|
error_notify "[ERROR]: Failed validation for the generated snapshot name."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,8 +276,8 @@ snapshot_create() {
|
|||||||
bastille start "${_jail}"
|
bastille start "${_jail}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Delay a sec for batch snapshot creation safety.
|
# Delay a sec only for batch snapshot creation when using md5 to generate names.
|
||||||
if [ -n "${SNAP_BATCH}" ]; then
|
if [ -n "${SNAP_BATCH}" ] && [ -n "${SNAP_CHECK}" ]; then
|
||||||
sleep 1
|
sleep 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user