Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle invalid subdomain error in Mac script #117

Merged
merged 1 commit into from May 24, 2018
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -15,7 +15,7 @@ function ctrl_c() {
#name of the current script. This will get overwritten by the child script which calls this
SCRIPT_NAME=configure-mac.sh
#version of the current script. This will get overwritten by the child script which calls this
SCRIPT_VERSION=1.4
SCRIPT_VERSION=1.5

#application tag. This will get overwritten by the child script which calls this
APP_TAG=
@@ -89,6 +89,9 @@ SUPPRESS_PROMPT="false"
#plist file path
PROP_FILE=

#Setting invalid subdomain value
INVALID_SUBDOMAIN=*".loggly.com"*

#manual instructions to be show in case of error
MANUAL_CONFIG_INSTRUCTION="Manual instructions to configure Loggly on Mac are available at https://www.loggly.com/docs/send-mac-logs-to-loggly/."

@@ -230,11 +233,16 @@ checkIfLogglyServersAccessible() {
fi

echo "INFO: Checking if '$LOGGLY_ACCOUNT' subdomain is valid."
if [ $(curl -s --head --request GET $LOGGLY_ACCOUNT_URL/login | grep "200 OK" | wc -l) == 1 ]; then
echo "INFO: $LOGGLY_ACCOUNT_URL is valid and reachable."
if [[ $LOGGLY_ACCOUNT != $INVALID_SUBDOMAIN ]]; then
if [ $(curl -s --head --request GET $LOGGLY_ACCOUNT_URL/login | grep "200 OK\|HTTP/2 200" | wc -l) == 1 ]; then
echo "INFO: $LOGGLY_ACCOUNT_URL is valid and reachable."
else
logMsgToConfigSysLog "ERROR" "ERROR: This is not a recognized subdomain. Please ask the account owner for the subdomain they signed up with."
exit 1
fi
else
logMsgToConfigSysLog "ERROR" "ERROR: This is not a recognized subdomain. Please ask the account owner for the subdomain they signed up with."
exit 1
logMsgToConfigSysLog "ERROR" "ERROR: This is not a recognized subdomain. Please ask the account owner for the subdomain they signed up with. Please note that your subdomain is just the first string in your loggly account URL not the entire account name."
exit 1
fi
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.