Skip to content

Commit

Permalink
Merge pull request #179 from malscent/MB-52637-UpdatesForServer712
Browse files Browse the repository at this point in the history
Adding retries to az login commands
  • Loading branch information
malscent authored Oct 25, 2022
2 parents 3eabc80 + 2738b58 commit 714627c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
13 changes: 11 additions & 2 deletions azure/Couchbase-VirtualMachine/gateway-startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,20 @@ fi

# Connection string should be param if passed
if [[ -n "$CONNECTION_PARAM" ]]; then
az login --identity
RETRY=0
until az login --identity --allow-no-subscriptions
do
RETRY=$((RETRY+1))
if [[ "$RETRY" == "25" ]]; then
echo "Attempted 25 times. Exiting"
exit 1
fi
sleep 1
echo "Failed Login. Trying again."
done
CONNECTION_STRING=$(az keyvault secret show --name "$CONNECTION_PARAM" --vault "$VAULT" | jq -r '.value')
fi


# if we don't have a connection string we need some default.. so we'll default to localhost
if [[ -z "$CONNECTION_STRING" ]]; then
CONNECTION_STRING="couchbase://localhost"
Expand Down
14 changes: 12 additions & 2 deletions azure/Couchbase-VirtualMachine/server-startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,17 @@ fi
echo "Retrieving Metadata"
METADATA=$(curl -s -H Metadata:true --noproxy "*" "http://169.254.169.254/metadata/instance?api-version=2021-02-01")

az login --identity --allow-no-subscriptions
RETRY=0
until az login --identity --allow-no-subscriptions
do
RETRY=$((RETRY+1))
if [[ "$RETRY" == "25" ]]; then
echo "Attempted 25 times. Exiting"
exit 1
fi
sleep 1
echo "Failed Login. Trying again."
done

function __get_tag() {
echo "$METADATA" | jq -r --arg param "$1" '.compute.tagsList[] | select(.name == $param) | .value'
Expand All @@ -36,7 +46,7 @@ if [[ -z "$DISK_LUN" ]]; then
DISK_LUN=NA
fi

DISK=$(lsscsi --brief | grep -G "\[[1-9]:0:0:$DISK_LUN\]" | awk -v col=2 '{print $col}')
DISK=$(lsscsi | grep -G "\[[1-9]:0:0:0\]" | grep -v "Virtual CD/ROM" | awk -v col=7 '{print $col}')

if [[ -z "$VERSION" ]]; then
VERSION="$COUCHBASE_SERVER_VERSION"
Expand Down
4 changes: 2 additions & 2 deletions azure/CouchbaseServer-Application/mainTemplate.json
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@
"couchbase-server-rally-parameter": "cb-rally",
"couchbase-server-services": "[couchbase.arrayToCSV(string(parameters('mdsConfig')[copyIndex()].colServices))]",
"key-vault": "[couchbase.generateResourceName('vault', parameters('_now'))]",
"couchbase-server-disk": "0",
"couchbase-server-disk": "33",
"couchbase-server-secret": "cb-secret"
},
"identity": {
Expand Down Expand Up @@ -683,7 +683,7 @@
},
"dataDisks": [
{
"lun": 0,
"lun": 33,
"createOption": "Empty",
"managedDisk": {
"storageAccountType": "Premium_LRS"
Expand Down

0 comments on commit 714627c

Please sign in to comment.