File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -763,7 +763,8 @@ retrieve_connection_info() {
763
763
case " ${RESPONSE} " in
764
764
200)
765
765
info " Successfully downloaded Rancher connection information"
766
- break
766
+ umask " ${UMASK} "
767
+ return 0
767
768
;;
768
769
* )
769
770
i=$(( i + 1 ))
@@ -773,7 +774,11 @@ retrieve_connection_info() {
773
774
;;
774
775
esac
775
776
done
777
+ error " Failed to download Rancher connection information in ${i} attempts"
776
778
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
777
782
fi
778
783
}
779
784
@@ -882,7 +887,7 @@ do_install() {
882
887
883
888
if [ -n " ${CATTLE_TOKEN} " ]; then
884
889
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 "
886
891
fi
887
892
create_systemd_service_file
888
893
create_env_file
You can’t perform that action at this time.
0 commit comments