This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ENVIRONMENTS=("dev2", "tst2", "shiptst1", "shiptst2", "stg1", "shipstg1") | |
SHIPS=("prd", "allure", "adventure", "anthem", "brilliance", "constellation", "edge", "enchantment", "equinox", "harmony", "independence", "liberty", "mariner", "majesty", "millennium", "navigator", "oasis", "pursuit", "quantum", "reflection", "spectrum", "summit", "serenade", "symphony", "vision") | |
if [[ "$environmentGroup" == "dev" && "$environmentChoice" == "all" ]] | |
then | |
ENV_NAMES=("dev2") | |
elif [[ "$environmentGroup" == "test" && "$environmentChoice" == "all" ]] | |
then | |
ENV_NAMES=("tst2" "shiptst1" "shiptst2") | |
elif [[ "$environmentGroup" == "stage" && "$environmentChoice" == "all" ]] | |
then | |
ENV_NAMES=("stg1" "shipstg1") | |
elif [[ "$environmentGroup" == "prod" && "$environmentChoice" == "all" ]] | |
then | |
SHIP_NAMES=("prd" "allure" "adventure" "anthem" "brilliance" "constellation" "edge" "enchantment" "equinox" "harmony" "independence" "liberty" "mariner" "majesty" "millennium" "navigator" "oasis" "pursuit" "quantum" "reflection" "spectrum" "summit" "serenade" "symphony" "vision") | |
elif [[ "$environmentGroup" == "prod" ]] | |
then | |
SHIP_NAMES=(${environmentChoice}) | |
else | |
ENV_NAMES=(${environmentChoice}) | |
fi | |
echo "Running for config $configSetSelection..." | |
echo "**************************************" | |
COLLECTION_NAME=${configSetSelection} | |
CONFIG_SET_NAME=${configSetSelection} | |
SHARDS=1 | |
FACTOR=2 | |
echo "Collection: $COLLECTION_NAME" | |
echo "ConfigSet: $CONFIG_SET_NAME" | |
echo "**************************************" | |
lower_env_create_collection() | |
{ | |
for ENV in ${ENV_NAMES[*]} | |
do | |
if [[ "${ENVIRONMENTS[@]}" =~ "${ENV}" ]] | |
then | |
echo "Environment: $ENV" | |
echo "**************************************" | |
curl -X GET "http://${ENV}.mesos.rccl.com/solr-cloud/v3/solr/admin/collections?action=CREATE&name=${COLLECTION_NAME}&numShards=${SHARDS}&replicationFactor=${FACTOR}&collection.configName=${CONFIG_SET_NAME}&wt=xml" | |
echo "**************************************" | |
else | |
echo "Incorrect environment choice!! Please enter (all) or specific environment from (${ENVIRONMENTS[*]}) " | |
fi | |
done | |
} | |
prod_create_collection() | |
{ | |
for SHIP in ${SHIP_NAMES[*]} | |
do | |
if [[ "${SHIPS[@]}" =~ "${SHIP}" ]] | |
then | |
if [[ "${SHIP}" == "prd" ]] | |
then | |
echo "Ship: $SHIP" | |
echo "**************************************" | |
curl -X GET "http://${SHIP}.mesos.rccl.com/solr-cloud/v3/solr/admin/collections?action=CREATE&name=${COLLECTION_NAME}&numShards=${SHARDS}&replicationFactor=${FACTOR}&collection.configName=${CONFIG_SET_NAME}&wt=xml" | |
else | |
echo "Ship: $SHIP" | |
echo "**************************************" | |
curl -X GET "http://mesos.${SHIP}.sh.rccl.com/solr-cloud/v3/solr/admin/collections?action=CREATE&name=${COLLECTION_NAME}&numShards=${SHARDS}&replicationFactor=${FACTOR}&collection.configName=${CONFIG_SET_NAME}&wt=xml" | |
echo "**************************************" | |
fi | |
else | |
echo "Incorrect ship choice!! Please enter specific ship from (${SHIPS[*]})" | |
fi | |
done | |
} | |
if [[ "${#SHIP_NAMES[@]}" -ne 0 ]] | |
then | |
prod_create_collection | |
elif [[ "${#ENV_NAMES[@]}" -ne 0 ]] | |
then | |
lower_env_create_collection | |
else | |
echo "Incorrect ship choice!!" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment