From 93c918061d301935a19f2dd9c93225f206fbd9ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Valur=20J=C3=B3nsson?= Date: Thu, 2 Nov 2017 18:32:53 +0000 Subject: [PATCH 1/3] Add batch-mode. auth token is trusted, account is gen2, no delivery tests, no prompts. --- Linux Script/configure-linux.sh | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/Linux Script/configure-linux.sh b/Linux Script/configure-linux.sh index ecb5b60..e67e342 100644 --- a/Linux Script/configure-linux.sh +++ b/Linux Script/configure-linux.sh @@ -75,6 +75,10 @@ LOGGLY_PASSWORD= #if this variable is set to true then suppress all prompts SUPPRESS_PROMPT="false" +#if this variable is "true", we are in batch mode: no remote tests are run +#and only account and token are required. +BATCH_MODE="false" + #variables used in 22-loggly.conf file LOGGLY_SYSLOG_PORT=6514 LOGGLY_DISTRIBUTION_ID="41058" @@ -127,14 +131,19 @@ checkLinuxLogglyCompatibility() { #check if the Loggly servers are accessible. If no, ask user to check network connectivity & exit checkIfLogglyServersAccessible - #check if user credentials are valid. If no, then exit - checkIfValidUserNamePassword + #if we have username and password, check and verify account + if [ "$LOGGLY_USERNAME" != "" -a "$LOGGLY_PASSWORD" != "" ]; then + + #check if user credentials are valid. If no, then exit + checkIfValidUserNamePassword - #get authentication token if not provided - getAuthToken + #get authentication token if not provided + getAuthToken - #check if authentication token is valid. If no, then exit. - checkIfValidAuthToken + #check if authentication token is valid. If no, then exit. + checkIfValidAuthToken + + fi #checking if syslog-ng is configured as a service checkifSyslogNgConfiguredAsService @@ -987,6 +996,7 @@ checkScriptRunningMode() { usage() { cat < Date: Fri, 3 Nov 2017 16:30:04 +0000 Subject: [PATCH 2/3] Rename to "unattended". Also skip server ping --- Linux Script/configure-linux.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Linux Script/configure-linux.sh b/Linux Script/configure-linux.sh index e67e342..ff88cc6 100644 --- a/Linux Script/configure-linux.sh +++ b/Linux Script/configure-linux.sh @@ -75,9 +75,9 @@ LOGGLY_PASSWORD= #if this variable is set to true then suppress all prompts SUPPRESS_PROMPT="false" -#if this variable is "true", we are in batch mode: no remote tests are run +#if this variable is "true", we are in unattended mode: no remote tests are run #and only account and token are required. -BATCH_MODE="false" +UNATTENDED_MODE="false" #variables used in 22-loggly.conf file LOGGLY_SYSLOG_PORT=6514 @@ -128,12 +128,12 @@ checkLinuxLogglyCompatibility() { #set the basic variables needed by this script setLinuxVariables - #check if the Loggly servers are accessible. If no, ask user to check network connectivity & exit - checkIfLogglyServersAccessible - - #if we have username and password, check and verify account - if [ "$LOGGLY_USERNAME" != "" -a "$LOGGLY_PASSWORD" != "" ]; then - + # in unattended mode, we don't do remote checks + fi [ "$UNATTENDED_MODE" != "true" ]; then + + #check if the Loggly servers are accessible. If no, ask user to check network connectivity & exit + checkIfLogglyServersAccessible + #check if user credentials are valid. If no, then exit checkIfValidUserNamePassword @@ -996,7 +996,7 @@ checkScriptRunningMode() { usage() { cat < Date: Fri, 3 Nov 2017 16:33:17 +0000 Subject: [PATCH 3/3] fix typo --- Linux Script/configure-linux.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Linux Script/configure-linux.sh b/Linux Script/configure-linux.sh index ff88cc6..31187c3 100644 --- a/Linux Script/configure-linux.sh +++ b/Linux Script/configure-linux.sh @@ -129,7 +129,7 @@ checkLinuxLogglyCompatibility() { setLinuxVariables # in unattended mode, we don't do remote checks - fi [ "$UNATTENDED_MODE" != "true" ]; then + if [ "$UNATTENDED_MODE" != "true" ]; then #check if the Loggly servers are accessible. If no, ask user to check network connectivity & exit checkIfLogglyServersAccessible