mirror of
https://gitlab.com/psuapp/psu.git
synced 2024-08-30 18:12:34 +00:00
Rename err function to echo_error
This commit is contained in:
parent
76caefc30b
commit
4ca1ab72c6
26
psu
26
psu
@ -36,7 +36,7 @@ main() {
|
||||
d) DEBUG_MODE="true" ;;
|
||||
t) STRICT_MODE="true" ;;
|
||||
*)
|
||||
err "Unexpected option ${option}"
|
||||
echo_error "Unexpected option ${option}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@ -106,7 +106,7 @@ main() {
|
||||
exit 0
|
||||
fi
|
||||
|
||||
err "Error: Unknown action \"$ACTION\"."
|
||||
echo_error "Error: Unknown action \"$ACTION\"."
|
||||
exit 1
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ main() {
|
||||
# Returns: #
|
||||
# None #
|
||||
############################
|
||||
err() {
|
||||
echo_error() {
|
||||
local error_message=$@
|
||||
echo "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: $error_message" >&2
|
||||
}
|
||||
@ -142,8 +142,8 @@ check_argument() {
|
||||
local argument_envvar=$3
|
||||
local argument_flag=$4
|
||||
if [ -z "$argument_value" ]; then
|
||||
err "Error: Missing argument \"$argument_name\"."
|
||||
err "Try setting \"$argument_envvar\" environment variable or using the \"-$argument_flag\" flag."
|
||||
echo_error "Error: Missing argument \"$argument_name\"."
|
||||
echo_error "Try setting \"$argument_envvar\" environment variable or using the \"-$argument_flag\" flag."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
@ -163,12 +163,12 @@ check_for_errors() {
|
||||
local response=$2
|
||||
if [ $exit_code -ne 0 ]; then
|
||||
case $exit_code in
|
||||
2) err 'Request timed out!' ;;
|
||||
3) err 'Unexpected HTTP 3xx Redirection!' ;;
|
||||
4) err 'HTTP 4xx Client Error!' && err $response ;;
|
||||
5) err 'HTTP 5xx Server Error!' && err $response ;;
|
||||
6) err 'Exceeded --max-redirects=<n> redirects!' ;;
|
||||
*) err 'Unholy Error!' ;;
|
||||
2) echo_error 'Request timed out!' ;;
|
||||
3) echo_error 'Unexpected HTTP 3xx Redirection!' ;;
|
||||
4) echo_error 'HTTP 4xx Client Error!' && echo_error $response ;;
|
||||
5) echo_error 'HTTP 5xx Server Error!' && echo_error $response ;;
|
||||
6) echo_error 'Exceeded --max-redirects=<n> redirects!' ;;
|
||||
*) echo_error 'Unholy Error!' ;;
|
||||
esac
|
||||
exit 1
|
||||
fi
|
||||
@ -306,7 +306,7 @@ deploy() {
|
||||
rm json.tmp
|
||||
else
|
||||
if [ $STRICT_MODE == "true" ]; then
|
||||
err "Error: Stack $PORTAINER_STACK_NAME already exists."
|
||||
echo_error "Error: Stack $PORTAINER_STACK_NAME already exists."
|
||||
exit 1
|
||||
fi
|
||||
echo_verbose "Stack $PORTAINER_STACK_NAME exists."
|
||||
@ -352,7 +352,7 @@ deploy() {
|
||||
undeploy() {
|
||||
if [ -z "$STACK" ]; then
|
||||
if [ $STRICT_MODE == "true" ]; then
|
||||
err "Error: Stack $PORTAINER_STACK_NAME does not exist."
|
||||
echo_error "Error: Stack $PORTAINER_STACK_NAME does not exist."
|
||||
exit 1
|
||||
else
|
||||
echo_verbose "Stack $PORTAINER_STACK_NAME does not exist. No need to undeploy it."
|
||||
|
Loading…
Reference in New Issue
Block a user