Last active
August 23, 2017 14:40
-
-
Save kshailen/b8d5cb5e20e01a0a5257bfc9594a2a68 to your computer and use it in GitHub Desktop.
CulsterManagerAPI Check
This file contains hidden or 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 | |
#Check for paas-cluster-manager | |
HOST=`fleetctl list-units | grep paas-cluster-manager| grep -w active | grep running |head -1 | awk '{print $2}' | awk -F"/" '{print $NF}'` | |
if [ -z $HOST ]then | |
echo "paas-cluster-manager is not running in this Cluster" | |
exit 1 | |
fi | |
responseBody=$(curl -silent POST --header "Content-Type: application/json" --header "Accept: application/json" -d "{ \"status\": \"InProgress\",\"id\": 0}" "http://${HOST}:3001/api/clustermanagers") | |
# getting id from response | |
id="$(grep -oP '(?<=id":).*?(?=})' <<< "$responseBody")" | |
#curl -X PATCH --header "Content-Type: application/x-www-form-urlencoded" --header "Accept: application/json" -d "id=$id" -d "cloud_formation_file=CloudFormation.json" "http://localhost:3001/api/ clustermanagers/updateCertificates" 2> /dev/null | |
#calling api/clustermanagers/updateCertificates API | |
curl -X PATCH --header "Content-Type: application/x-www-form-urlencoded" --header "Accept: application/json" -d "id=${id}&pkcs12_pass=batw1ngs" "http://${HOST}:3001/api/clustermanagers/updateCertificates" | |
if [ $? -eq 0 ]then | |
echo "updateCertificates api is working fine" | |
else | |
echo "updateCertificates api is not working fine" | |
exit 2 | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment