returnupdateMessage("You are already running the most recent version of ‘minio’.")
msg,err:=colorizeUpdateMessage(msg)
fatalIf(err.Trace(msg),"Unable to colorize experimental update notification string ‘"+msg+"’.",nil)
returnmsg
}
// JSON jsonified update message
// JSON jsonified update message.
func(uupdateMessage)JSON()string{
u.Status="success"
updateMessageJSONBytes,err:=json.Marshal(u)
fatalIf(probe.NewError(err),"Unable to marshal into JSON.",nil)
returnstring(updateMessageJSONBytes)
}
funcgetExperimentalUpdate(){
current,e:=time.Parse(time.RFC3339,minioVersion)
fatalIf(probe.NewError(e),"Unable to parse Version string as time.",nil)
ifcurrent.IsZero(){
fatalIf(probe.NewError(errors.New("")),"Experimental updates are not supported for custom build. Version field is empty. Please download official releases from https://dl.minio.io:9000",nil)
}
resp,err:=http.Get(minioExperimentalURL)
fatalIf(probe.NewError(err),"Unable to initalize experimental URL.",nil)
varexperimentalsupdates
decoder:=json.NewDecoder(resp.Body)
deferresp.Body.Close()
e=decoder.Decode(&experimentals)
fatalIf(probe.NewError(e),"Unable to decode experimental update notification.",nil)
fatalIf(probe.NewError(e),"Unable to parse BuildDate.",nil)
iflatest.IsZero(){
fatalIf(probe.NewError(errors.New("")),"Unable to validate any experimental update available at this time. Please open an issue at https://github.com/minio/minio/issues",nil)
fatalIf(probe.NewError(e),"Unable to read from update URL ‘"+updateURL+"’.",nil)
updateMessage:=updateMessage{
Download:downloadURL,
Version:minioVersion,
}
iflatest.After(current){
updateMessage.Update=true
ifminioVersion=="UNOFFICIAL.GOGET"{
fatalIf(probe.NewError(errors.New("")),
"Update mechanism is not supported for ‘go get’ based binary builds. Please download official releases from https://minio.io/#minio",nil)
}
ifglobalJSONFlag{
Println(updateMessage.JSON())
}else{
Println(updateMessage)
}
}
funcgetReleaseUpdate(){
current,e:=time.Parse(time.RFC3339,minioVersion)
fatalIf(probe.NewError(e),"Unable to parse Version string as time.",nil)
fatalIf(probe.NewError(e),"Unable to parse version string as time.",nil)
ifcurrent.IsZero(){
fatalIf(probe.NewError(errors.New("")),"Updates not supported for custom build. Version field is empty. Please download official releases from https://dl.minio.io:9000",nil)
fatalIf(probe.NewError(errors.New("")),
"Updates not supported for custom builds. Version field is empty. Please download official releases from https://minio.io/#minio",nil)
}
resp,err:=http.Get(minioUpdateURL)
fatalIf(probe.NewError(err),"Unable to initalize experimental URL.",nil)
varreleasesupdates
decoder:=json.NewDecoder(resp.Body)
e=decoder.Decode(&releases)
varupdatesminioUpdates
decoder:=json.NewDecoder(data.Body)
e=decoder.Decode(&updates)
fatalIf(probe.NewError(e),"Unable to decode update notification.",nil)
fatalIf(probe.NewError(e),"Unable to parse BuildDate.",nil)
}
iflatest.IsZero(){
fatalIf(probe.NewError(errors.New("")),"Unable to validate any update available at this time. Please open an issue at https://github.com/minio/minio/issues",nil)
fatalIf(probe.NewError(errors.New("")),
"Unable to validate any update available at this time. Please open an issue at https://github.com/minio/minio/issues",nil)