Skip to content

Commit

Permalink
Merge pull request #151 from vwbusguy/bugfix/rancher-connection-info-…
Browse files Browse the repository at this point in the history
…fail

Cleanup and exit if cannot download valid connection info.
  • Loading branch information
jakefhyde authored Feb 2, 2024
2 parents 806ef42 + a375cff commit df30d89
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 "Failed to download Rancher connection information in ${i} attempts"
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 "Aborting system-agent installation due to failure to retrieve Rancher connection information"
fi
create_systemd_service_file
create_env_file
Expand Down

0 comments on commit df30d89

Please sign in to comment.