Skip to content

Commit

Permalink
Increased retries and times for the sleep
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Verdaguer Velázquez <[email protected]>
  • Loading branch information
verdx authored and snaow committed Mar 10, 2023
1 parent 81675c7 commit 8078c00
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions unattended_installer/install_functions/dashboard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,13 @@ function dashboard_initializeAIO() {
installCommon_getPass "admin"
http_code=$(curl -XGET https://localhost/status -uadmin:"${u_pass}" -k -w %"{http_code}" -s -o /dev/null)
retries=0
max_dashboard_initialize_retries=5
max_dashboard_initialize_retries=20
while [ "${http_code}" -ne "200" ] && [ "${retries}" -lt "${max_dashboard_initialize_retries}" ]
do
common_logger "Wazuh dashboard web application not yet initialized. Waiting..."
http_code=$(curl -XGET https://localhost/status -uadmin:"${u_pass}" -k -w %"{http_code}" -s -o /dev/null)
retries=$((retries+1))
sleep 1
sleep 15
done
if [ "${http_code}" -eq "200" ]; then
common_logger "Wazuh dashboard web application initialized."
Expand Down
4 changes: 2 additions & 2 deletions unattended_installer/passwords_tool/passwordsFunctions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -294,15 +294,15 @@ function passwords_generatePasswordFile() {
function passwords_getApiToken() {

retries=0
max_internal_error_retries=10
max_internal_error_retries=20

TOKEN_API=$(curl -s -u "${adminUser}":"${adminPassword}" -k -X GET "https://localhost:55000/security/user/authenticate?raw=true" --max-time 300 --retry 5 --retry-delay 5)
while [[ "${TOKEN_API}" =~ "Wazuh Internal Error" ]] && [ "${retries}" -lt "${max_internal_error_retries}" ]
do
common_logger "There was an error accessing the API. Retrying..."
TOKEN_API=$(curl -s -u "${adminUser}":"${adminPassword}" -k -X GET "https://localhost:55000/security/user/authenticate?raw=true" --max-time 300 --retry 5 --retry-delay 5)
retries=$((retries+1))
sleep 1
sleep 10
done
if [[ ${TOKEN_API} =~ "Wazuh Internal Error" ]]; then
common_logger -e "There was an error while trying to get the API token."
Expand Down

0 comments on commit 8078c00

Please sign in to comment.