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

Resolve invalid subdomain issue #112

Merged
merged 1 commit into from Feb 21, 2018

Conversation

@Shwetajain148
Copy link
Contributor

@Shwetajain148 Shwetajain148 commented Jan 30, 2018

@mchaudhary In this PR, I have put a check to validate if the subdomain contains .loggly.com with it. The user must enter only the first string of his account name for the subdomain. If user enters the complete account name, the script will mark this subdomain invalid, display an error message and will exit.

I have also added a clear exit message so the users do not confuse.

Please review.

@@ -350,10 +353,15 @@ checkIfLogglyServersAccessible() {
fi

echo "INFO: Checking if '$LOGGLY_ACCOUNT' subdomain is valid."
if [ $(curl --head -s --request GET $LOGGLY_ACCOUNT_URL/login | grep "200 OK\|HTTP/2 200" | wc -l) ] >0; then
echo "INFO: $LOGGLY_ACCOUNT_URL is valid and reachable."
if [[ $LOGGLY_ACCOUNT != $INVALID_SUBDOMAIN ]]; then

This comment has been minimized.

@Shwetajain148

Shwetajain148 Jan 30, 2018
Author Contributor

@mchaudhary, This condition is to check if the subdomain is not invalid i.e. it does not contain .loggly.com in it.

@@ -350,10 +353,15 @@ checkIfLogglyServersAccessible() {
fi

echo "INFO: Checking if '$LOGGLY_ACCOUNT' subdomain is valid."
if [ $(curl --head -s --request GET $LOGGLY_ACCOUNT_URL/login | grep "200 OK\|HTTP/2 200" | wc -l) ] >0; then

This comment has been minimized.

@Shwetajain148

Shwetajain148 Jan 30, 2018
Author Contributor

@mchaudhary, At this point earlier, if I pass any invalid subdomain which doesn't contain .loggly.com with it but also does not exist, the script was marking it as a valid subdomain and showing it is reachable. This was happening because it checks at last if wc -l > 0 then mark the subdomain valid and reachable. But actually what happens is if we pass any invalid subdomain which does not exist, the response is multiline which satisfies this condition and subdomain is marked as valid.

Note: In both valid and invalid subdomain the response is in multiline so the script could not differentiate.

if [ $(curl --head -s --request GET $LOGGLY_ACCOUNT_URL/login | grep "200 OK\|HTTP/2 200" | wc -l) ] >0; then
echo "INFO: $LOGGLY_ACCOUNT_URL is valid and reachable."
if [[ $LOGGLY_ACCOUNT != $INVALID_SUBDOMAIN ]]; then
if [[ $(curl --head -s --request GET $LOGGLY_ACCOUNT_URL/login | grep "200 OK\|HTTP/2 200") ]]; then

This comment has been minimized.

@Shwetajain148

Shwetajain148 Jan 30, 2018
Author Contributor

I modified this condition to grep only the 200 response code and then mark the subdomain valid.

@mchaudhary mchaudhary merged commit 863733c into loggly:master Feb 21, 2018
@Shwetajain148 Shwetajain148 deleted the Shwetajain148:handle-invalid-subdomain branch Mar 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.