[parser] Added --force option
[cmd_export] Now interpretes --force option by ignoring disk usage
This commit is contained in:
parent
c2c3cc8ab8
commit
4ce3372521
2 changed files with 13 additions and 4 deletions
|
@ -13,6 +13,7 @@
|
||||||
# }
|
# }
|
||||||
|
|
||||||
cmd_export() {
|
cmd_export() {
|
||||||
|
[[ "${1}" == "-f" ]] && { local FORCE="force"; shift; }
|
||||||
local GIT_DIR="${1}"
|
local GIT_DIR="${1}"
|
||||||
local TARGET="${2}"
|
local TARGET="${2}"
|
||||||
local OLD_COMMIT="${3}"
|
local OLD_COMMIT="${3}"
|
||||||
|
@ -41,7 +42,11 @@ cmd_export() {
|
||||||
local presentidList=($(awk 'BEGIN{FS="\t"}{if($1=="true" && $4!="null"){print $2}}' ${DB_FILE} | awk '!seen[$0]++'))
|
local presentidList=($(awk 'BEGIN{FS="\t"}{if($1=="true" && $4!="null"){print $2}}' ${DB_FILE} | awk '!seen[$0]++'))
|
||||||
local DU="$(( $(print_imageid_du ${GIT_DIR} ${futureidList[@]}) - $(print_imageid_du "${GIT_DIR}" ${presentidList[@]}) ))"
|
local DU="$(( $(print_imageid_du ${GIT_DIR} ${futureidList[@]}) - $(print_imageid_du "${GIT_DIR}" ${presentidList[@]}) ))"
|
||||||
local DF="$(df ${TARGET} --output=avail -B1 | tail -n -1)"
|
local DF="$(df ${TARGET} --output=avail -B1 | tail -n -1)"
|
||||||
[[ ${DU} -ge ${DF} ]] && { _msg ECHO "Target does not have enough space for deployable IMAGEID. Need ${DU}, has ${DF}."; return 2; }
|
|
||||||
|
if [[ ${DU} -ge ${DF} ]] && [[ ${FORCE} != "force" ]]; then
|
||||||
|
_msg ECHO "Target does not have enough space for deployable IMAGEID. Need ${DU}, has ${DF}."
|
||||||
|
return 4
|
||||||
|
fi
|
||||||
|
|
||||||
# Cleans target of removable TRACKID
|
# Cleans target of removable TRACKID
|
||||||
local COUNT=1
|
local COUNT=1
|
||||||
|
|
10
src/parser
10
src/parser
|
@ -32,6 +32,10 @@ while true; do
|
||||||
_BATCHID="${1}"
|
_BATCHID="${1}"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
--force|-f)
|
||||||
|
_FORCE="force"
|
||||||
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
|
@ -98,21 +102,21 @@ case "${1}" in
|
||||||
--from)
|
--from)
|
||||||
shift
|
shift
|
||||||
OLD_COMMIT=${1}
|
OLD_COMMIT=${1}
|
||||||
shift
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
TARGET="${1}"
|
TARGET="${1}"
|
||||||
shift
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
shift
|
||||||
done
|
done
|
||||||
cmd_export "${_GIT_DIR}" "${TARGET}" "${OLD_COMMIT}"
|
cmd_export $([[ ${_FORCE} == "force" ]] && echo '-f') "${_GIT_DIR}" "${TARGET}" ${OLD_COMMIT}
|
||||||
EXIT=$?
|
EXIT=$?
|
||||||
[[ ${EXIT} -eq 0 ]] && echo "Deployment completed successfully"
|
[[ ${EXIT} -eq 0 ]] && echo "Deployment completed successfully"
|
||||||
[[ ${EXIT} -eq 1 ]] && echo "Deployment completed with errors"
|
[[ ${EXIT} -eq 1 ]] && echo "Deployment completed with errors"
|
||||||
[[ ${EXIT} -eq 3 ]] && echo "Database file non-existent"
|
[[ ${EXIT} -eq 3 ]] && echo "Database file non-existent"
|
||||||
[[ ${EXIT} -eq 2 ]] && echo "Git directory not a valid git repository"
|
[[ ${EXIT} -eq 2 ]] && echo "Git directory not a valid git repository"
|
||||||
|
[[ ${EXIT} -eq 4 ]] && echo "Not enough space on device"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
update)
|
update)
|
||||||
|
|
Loading…
Reference in a new issue