summaryrefslogtreecommitdiff
path: root/scripts/rabbitmq-server
diff options
context:
space:
mode:
authorLuke Bakken <lbakken@pivotal.io>2018-09-06 07:49:19 -0700
committerLuke Bakken <lbakken@pivotal.io>2018-09-06 17:04:49 -0700
commit11915db3bad8f9d226e4a1c443d4e971e624389d (patch)
tree10698974ad12857057c74e03bda77d788a0a238b /scripts/rabbitmq-server
parent7ef3b27c78673a94ef157bb1158bc321db146a2e (diff)
downloadrabbitmq-server-git-11915db3bad8f9d226e4a1c443d4e971e624389d.tar.gz
Format errors and warnings with regard to config files in a manner similar to lager
Use exit code 64 when configuration is invalid Correctly deal with RABBITMQ_PID_FILE Fix bug in setting up RABBITMQ_PID_FILE as well as printing multi-line warnings and errors Calculate indent
Diffstat (limited to 'scripts/rabbitmq-server')
-rwxr-xr-xscripts/rabbitmq-server28
1 files changed, 14 insertions, 14 deletions
diff --git a/scripts/rabbitmq-server b/scripts/rabbitmq-server
index 86f213b3de..36dca38882 100755
--- a/scripts/rabbitmq-server
+++ b/scripts/rabbitmq-server
@@ -93,17 +93,17 @@ RABBITMQ_CONFIG_FILE_NOEX=$(get_noex ${RABBITMQ_CONFIG_FILE})
if [ "${RABBITMQ_CONFIG_FILE_NOEX}" = "${RABBITMQ_CONFIG_FILE}" ]; then
if [ -f "${RABBITMQ_CONFIG_FILE_NOEX}.config" ]; then
if [ -f "${RABBITMQ_CONFIG_FILE_NOEX}.conf" ]; then
- # Both files exist. Print a warning
- echo "WARNING: Both old (.config) and new (.conf) format config files exist."
- echo "WARNING: Using the old format config file: ${RABBITMQ_CONFIG_FILE_NOEX}.config"
- echo "WARNING: Please update your config files to the new format and remove the old file"
+ # Both files exist. Print a warning.
+ _rmq_env_pwarn 'Both old (.config) and new (.conf) format config files exist.' \
+ "Using the old format config file: ${RABBITMQ_CONFIG_FILE_NOEX}.config" \
+ 'Please update your config files to the new format and remove the old file.'
fi
RABBITMQ_CONFIG_FILE="${RABBITMQ_CONFIG_FILE_NOEX}.config"
elif [ -f "${RABBITMQ_CONFIG_FILE_NOEX}.conf" ]; then
RABBITMQ_CONFIG_FILE="${RABBITMQ_CONFIG_FILE_NOEX}.conf"
else
if [ -f ${RABBITMQ_ADVANCED_CONFIG_FILE} ]; then
- echo "WARNING: Using RABBITMQ_ADVANCED_CONFIG_FILE: ${RABBITMQ_ADVANCED_CONFIG_FILE}"
+ _rmq_env_pwarn "Using RABBITMQ_ADVANCED_CONFIG_FILE: ${RABBITMQ_ADVANCED_CONFIG_FILE}"
fi
# No config file exist. Use advanced config for -config arg.
RABBITMQ_CONFIG_ARG_FILE="${RABBITMQ_ADVANCED_CONFIG_FILE}"
@@ -125,23 +125,23 @@ elif [ "${RABBITMQ_CONFIG_FILE_NOEX}.conf" = "${RABBITMQ_CONFIG_FILE}" ]; then
elif [ "x" != "x${RABBITMQ_CONFIG_FILE}" \
-a "${RABBITMQ_CONFIG_FILE_NOEX}" != "${RABBITMQ_CONFIG_FILE}" ]; then
# Config file has an extension, but it's neither .conf or .config
- echo "ERROR: Wrong extension for RABBITMQ_CONFIG_FILE: ${RABBITMQ_CONFIG_FILE}"
- echo "ERROR: extension should be either .conf or .config"
- exit 1
+ _rmq_env_perr "Wrong extension for RABBITMQ_CONFIG_FILE: ${RABBITMQ_CONFIG_FILE}" \
+ 'The extension should be either .conf or .config'
+ exit 64 # EX_USAGE
fi
RABBITMQ_CONFIG_ARG_FILE_NOEX=$(get_noex ${RABBITMQ_CONFIG_ARG_FILE})
if [ "${RABBITMQ_CONFIG_ARG_FILE_NOEX}.config" != "${RABBITMQ_CONFIG_ARG_FILE}" ]; then
if [ "${RABBITMQ_CONFIG_ARG_FILE}" = "${RABBITMQ_ADVANCED_CONFIG_FILE}" ]; then
- echo "ERROR: Wrong extension for RABBITMQ_ADVANCED_CONFIG_FILE: ${RABBITMQ_ADVANCED_CONFIG_FILE}"
- echo "ERROR: extension should be .config"
- exit 1
+ _rmq_env_perr "Wrong extension for RABBITMQ_ADVANCED_CONFIG_FILE: ${RABBITMQ_ADVANCED_CONFIG_FILE}" \
+ 'The extension should be .config'
+ exit 64 # EX_USAGE
else
# We should never got here, but still there should be some explanation
- echo "ERROR: Wrong extension for ${RABBITMQ_CONFIG_ARG_FILE}"
- echo "ERROR: extension should be .config"
- exit 1
+ _rmq_env_perr "Wrong extension for ${RABBITMQ_CONFIG_ARG_FILE}"
+ 'The extension should be .config'
+ exit 64 # EX_USAGE
fi
fi