Created
March 9, 2016 19:06
-
-
Save smbambling/e99da7ae188caf857d3d to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
node_fqdn=$(hostname -f) | |
prettyjson='python -m json.tool' | |
# Generate Token for code-deployer RBAC user (5y Lifetime) | |
token_file_loc='/root/.puppetlabs/code-deployer_token' | |
# Trigger Code-Manager Deployment of ALL environments | |
function trigger_run() { | |
curl -s -k -X POST -H 'Content-Type: application/json' \ | |
-H "X-Authentication: $(cat $token_file_loc)" \ | |
-d '{"deploy-all": true, "wait": true}' \ | |
https://$node_fqdn:8170/code-manager/v1/deploys | |
} | |
tempout=$(mktemp) | |
trigger_run > "$tempout" & | |
pid=$! # Process Id of the previous running command | |
spin='-\|/' | |
i=0 | |
printf "\n" | |
while kill -0 $pid 2>/dev/null | |
do | |
i=$(( (i+1) %4 )) | |
printf "\rRunning Code-Manager and File-Sync: ${spin:$i:1}" | |
sleep .1 | |
done | |
printf "\rRunning Code-Manager and File-Sync: Complete\n\n" | |
cat $tempout | $prettyjson | |
rm -f $mktemp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment