File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -763,7 +763,8 @@ retrieve_connection_info() {
763763 case " ${RESPONSE} " in
764764 200)
765765 info " Successfully downloaded Rancher connection information"
766- break
766+ umask " ${UMASK} "
767+ return 0
767768 ;;
768769 * )
769770 i=$(( i + 1 ))
@@ -773,7 +774,11 @@ retrieve_connection_info() {
773774 ;;
774775 esac
775776 done
777+ error " Failed to download Rancher connection information in ${i} attempts"
776778 umask " ${UMASK} "
779+ # Clean up invalid rancher2_connection_info.json file
780+ rm -f ${CATTLE_AGENT_VAR_DIR} /rancher2_connection_info.json
781+ return 1
777782 fi
778783}
779784
@@ -882,7 +887,7 @@ do_install() {
882887
883888 if [ -n " ${CATTLE_TOKEN} " ]; then
884889 generate_cattle_identifier
885- retrieve_connection_info # Only retrieve connection information from Rancher if a token was passed in.
890+ retrieve_connection_info || fatal " Aborting system-agent installation due to failure to retrieve Rancher connection information "
886891 fi
887892 create_systemd_service_file
888893 create_env_file
You can’t perform that action at this time.
0 commit comments