Skip to content
Snippets Groups Projects
Commit 0bc60424 authored by bta's avatar bta
Browse files

Revert "get-config: use --retry-connrefused instead of --retry-all-errors"

This reverts commit 6c4687e4.
parent 36d7ad8d
No related branches found
No related tags found
No related merge requests found
......@@ -52,7 +52,7 @@ function debug() {
# authenticate and get the token
function getTokenJSON() {
# store the whole response with the status at the end
HTTP_RESPONSE=$(curl --retry-connrefused --retry ${MAX_RETRY} -s -k -w "HTTPSTATUS:%{http_code}" --max-time 10 -X POST -H "Content-Type: application/json" -d "{\"login\":\"guest\",\"pwd\":\"\"}" ${API_BASE_URL}/login)
HTTP_RESPONSE=$(curl --retry-all-errors --retry ${MAX_RETRY} -s -k -w "HTTPSTATUS:%{http_code}" --max-time 10 -X POST -H "Content-Type: application/json" -d "{\"login\":\"guest\",\"pwd\":\"\"}" ${API_BASE_URL}/login)
ret=$?
if [[ $ret != 0 ]]; then
......@@ -102,7 +102,7 @@ getConfigVars() {
TOKEN=`echo ${TOKEN_JSON} | jsonValue token 1`
MACHINE_NAME=`hostname`
echo "Getting machine configuration..."
MACHINE_JSON=`/usr/bin/curl --retry-connrefused --retry ${MAX_RETRY} -s -k --max-time 10 -H "Authorization: Bearer ${TOKEN}" -X GET ${API_BASE_URL}/machines/name/${MACHINE_NAME}`
MACHINE_JSON=`/usr/bin/curl --retry-all-errors --retry ${MAX_RETRY} -s -k --max-time 10 -H "Authorization: Bearer ${TOKEN}" -X GET ${API_BASE_URL}/machines/name/${MACHINE_NAME}`
MACHINE_ID=`echo $MACHINE_JSON | jsonValue id 1`
MACHINE_CONFIGS_ID=`echo $MACHINE_JSON | jsonValue configs_id 1`
CONFIG_NAME=`echo $MACHINE_JSON | jsonValue name 2`
......@@ -128,7 +128,7 @@ getConfigFile() {
echo "Error downloading config file (machine_id empty, maybe it is not in LabManager's DB)"
return 1
fi
HTTP_STATUS=`/usr/bin/curl --retry-connrefused --retry ${MAX_RETRY} -s -k -w "%{http_code}" -o /local/esame-machine.conf --max-time 10 --header "Authorization: Bearer ${TOKEN}" -X GET ${API_BASE_URL}/machines/${MACHINE_ID}/configfile`
HTTP_STATUS=`/usr/bin/curl --retry-all-errors --retry ${MAX_RETRY} -s -k -w "%{http_code}" -o /local/esame-machine.conf --max-time 10 --header "Authorization: Bearer ${TOKEN}" -X GET ${API_BASE_URL}/machines/${MACHINE_ID}/configfile`
if [[ $HTTP_STATUS -ne 200 ]]
then
echo "Error downloading config file (http_status=$HTTP_STATUS)"
......@@ -142,7 +142,7 @@ getConfigFile() {
getIpConfigFile() {
echo "Downloading machine iptables config file..."
# get ipconfig file
HTTP_STATUS=`/usr/bin/curl --retry-connrefused --retry ${MAX_RETRY} -s -k -w "%{http_code}" -o /local/iptables --max-time 10 --header "Authorization: Bearer ${TOKEN}" -X GET ${API_BASE_URL}/machines/${MACHINE_ID}/ipconfigfile`
HTTP_STATUS=`/usr/bin/curl --retry-all-errors --retry ${MAX_RETRY} -s -k -w "%{http_code}" -o /local/iptables --max-time 10 --header "Authorization: Bearer ${TOKEN}" -X GET ${API_BASE_URL}/machines/${MACHINE_ID}/ipconfigfile`
if [[ $HTTP_STATUS -ne 200 ]]
then
echo "Error downloading iptables config file (http_status=$HTTP_STATUS)"
......@@ -155,7 +155,7 @@ getIpConfigFile() {
updateCurrentConfigId() {
# Update this machine's current config id
HTTP_STATUS=`/usr/bin/curl --retry-connrefused --retry ${MAX_RETRY} -s -k -w "%{http_code}" -o /dev/null --max-time 10 -H "Content-Type: application/json" -H "Authorization: Bearer ${TOKEN}" \
HTTP_STATUS=`/usr/bin/curl --retry-all-errors --retry ${MAX_RETRY} -s -k -w "%{http_code}" -o /dev/null --max-time 10 -H "Content-Type: application/json" -H "Authorization: Bearer ${TOKEN}" \
-X PUT -d "{\"current_configs_id\":\"$MACHINE_CONFIGS_ID\"}" ${API_BASE_URL}/machines/${MACHINE_ID}/currentconfig`
if [[ $HTTP_STATUS -ne 200 ]]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment