From 503a3219ce69bc74e31e6a07e13be998a261aa09 Mon Sep 17 00:00:00 2001 From: Mike Ro Date: Fri, 15 Dec 2023 16:42:32 -0800 Subject: [PATCH] fix: Fail as unsupported when inputs are bad --- .../newrelic/infrastructure/ohi/cassandra/debian.yml | 12 ++++++------ .../newrelic/infrastructure/ohi/cassandra/rhel.yml | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/recipes/newrelic/infrastructure/ohi/cassandra/debian.yml b/recipes/newrelic/infrastructure/ohi/cassandra/debian.yml index c21e43882..25ae3bab6 100644 --- a/recipes/newrelic/infrastructure/ohi/cassandra/debian.yml +++ b/recipes/newrelic/infrastructure/ohi/cassandra/debian.yml @@ -64,7 +64,7 @@ install: - task: input_assert vars: MAX_RETRIES: 3 - EXIT130: "" + EXIT131: "" - task: restart assert_pre_req: @@ -154,17 +154,17 @@ install: if [[ "$NEW_RELIC_ASSUME_YES" == "true" ]]; then NODETOOL_RESPONSE=$(nodetool -p "$NEW_RELIC_CASSANDRA_PORT" -h "$NEW_RELIC_CASSANDRA_HOSTNAME" -u "$NEW_RELIC_CASSANDRA_USERNAME" -pw "$NEW_RELIC_CASSANDRA_PASSWORD" version 2>&1) if [ $(echo $NODETOOL_RESPONSE | grep -i "Failed to connect" | wc -l) -gt 0 ]; then - EXIT130=" - NEW_RELIC_CASSANDRA_PORT=\n - NEW_RELIC_CASSANDRA_HOSTNAME=" + EXIT131=" - NEW_RELIC_CASSANDRA_PORT=\n - NEW_RELIC_CASSANDRA_HOSTNAME=" fi if [ $(echo $NODETOOL_RESPONSE | grep -Ei "Invalid username or password|Required values.*not provided" | wc -l) -gt 0 ]; then - EXIT130=" - NEW_RELIC_CASSANDRA_USERNAME=\n - NEW_RELIC_CASSANDRA_PASSWORD=" + EXIT131=" - NEW_RELIC_CASSANDRA_USERNAME=\n - NEW_RELIC_CASSANDRA_PASSWORD=" fi fi - if [ "$EXIT130" != "" ]; then - printf "There is a problem with the required environment variables. Please set the following variable(s) and try again:\n\n$EXIT130\n" - exit 130 + if [ "$EXIT131" != "" ]; then + printf "There is a problem with the required environment variables. Please set the following variable(s) and try again:\n\n$EXIT131\n" + exit 131 else printf "\n[OK] All checks passed. Installing Cassandra Integration...\n\n" fi diff --git a/recipes/newrelic/infrastructure/ohi/cassandra/rhel.yml b/recipes/newrelic/infrastructure/ohi/cassandra/rhel.yml index 3534bb49f..bb4047163 100644 --- a/recipes/newrelic/infrastructure/ohi/cassandra/rhel.yml +++ b/recipes/newrelic/infrastructure/ohi/cassandra/rhel.yml @@ -68,7 +68,7 @@ install: - task: input_assert vars: MAX_RETRIES: 3 - EXIT130: "" + EXIT131: "" - task: restart assert_pre_req: @@ -159,17 +159,17 @@ install: if [[ "$NEW_RELIC_ASSUME_YES" == "true" ]]; then NODETOOL_RESPONSE=$(nodetool -p "$NEW_RELIC_CASSANDRA_PORT" -h "$NEW_RELIC_CASSANDRA_HOSTNAME" -u "$NEW_RELIC_CASSANDRA_USERNAME" -pw "$NEW_RELIC_CASSANDRA_PASSWORD" version 2>&1) if [ $(echo $NODETOOL_RESPONSE | grep -i "Failed to connect" | wc -l) -gt 0 ]; then - EXIT130=" - NEW_RELIC_CASSANDRA_PORT=\n - NEW_RELIC_CASSANDRA_HOSTNAME=" + EXIT131=" - NEW_RELIC_CASSANDRA_PORT=\n - NEW_RELIC_CASSANDRA_HOSTNAME=" fi if [ $(echo $NODETOOL_RESPONSE | grep -Ei "Invalid username or password|Required values.*not provided" | wc -l) -gt 0 ]; then - EXIT130=" - NEW_RELIC_CASSANDRA_USERNAME=\n - NEW_RELIC_CASSANDRA_PASSWORD=" + EXIT131=" - NEW_RELIC_CASSANDRA_USERNAME=\n - NEW_RELIC_CASSANDRA_PASSWORD=" fi fi - if [ "$EXIT130" != "" ]; then - printf "There is a problem with the required environment variables. Please set the following variable(s) and try again:\n\n$EXIT130\n" - exit 130 + if [ "$EXIT131" != "" ]; then + printf "There is a problem with the required environment variables. Please set the following variable(s) and try again:\n\n$EXIT131\n" + exit 131 else printf "\n[OK] All checks passed. Installing Cassandra Integration...\n\n" fi