Skip to content

Commit

Permalink
Cleanup and exit if cannot download valid connection info.
Browse files Browse the repository at this point in the history
Signed-off-by: Scott Williams <scottwilliams@ucsb.edu>
  • Loading branch information
vwbusguy committed Jan 4, 2024
1 parent 806ef42 commit d79dee6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,8 @@ retrieve_connection_info() {
case "${RESPONSE}" in
200)
info "Successfully downloaded Rancher connection information"
break
umask "${UMASK}"
return 0
;;
*)
i=$((i + 1))
Expand All @@ -773,7 +774,11 @@ retrieve_connection_info() {
;;
esac
done
error "Max retries exceeded for downloading Rancher connection information."
umask "${UMASK}"
# Clean up invalid rancher2_connection_info.json file
rm -f ${CATTLE_AGENT_VAR_DIR}/rancher2_connection_info.json
return 1
fi
}

Expand Down Expand Up @@ -882,7 +887,7 @@ do_install() {

if [ -n "${CATTLE_TOKEN}" ]; then
generate_cattle_identifier
retrieve_connection_info # Only retrieve connection information from Rancher if a token was passed in.
retrieve_connection_info || fatal "Could not get connection_info before max retries" # Only retrieve connection information from Rancher if a token was passed in.
fi
create_systemd_service_file
create_env_file
Expand Down

0 comments on commit d79dee6

Please sign in to comment.