Fix broken 'minio update' command on Windows (#5816)

This commit is contained in:
Harshavardhana 2018-04-13 11:51:03 -07:00 committed by kannappanr
parent 42f775af4f
commit bcd54632f5

View File

@ -81,6 +81,12 @@ var (
minioReleaseURL + "minio.sha256sum", minioReleaseURL + "minio.sha256sum",
minioReleaseURL + "minio.shasum", minioReleaseURL + "minio.shasum",
} }
// For windows our files have .exe additionally.
minioReleaseWindowsInfoURLs = []string{
minioReleaseURL + "minio.exe.sha256sum",
minioReleaseURL + "minio.exe.shasum",
}
) )
// minioVersionToReleaseTime - parses a standard official release // minioVersionToReleaseTime - parses a standard official release
@ -334,13 +340,19 @@ func downloadReleaseURL(releaseChecksumURL string, timeout time.Duration, mode s
// DownloadReleaseData - downloads release data from minio official server. // DownloadReleaseData - downloads release data from minio official server.
func DownloadReleaseData(timeout time.Duration, mode string) (data string, err error) { func DownloadReleaseData(timeout time.Duration, mode string) (data string, err error) {
for _, url := range minioReleaseInfoURLs { releaseURLs := minioReleaseInfoURLs
data, err = downloadReleaseURL(url, timeout, mode) if runtime.GOOS == globalWindowsOSName {
if err == nil { releaseURLs = minioReleaseWindowsInfoURLs
return data, err
}
} }
return data, fmt.Errorf("Failed to fetch release URL - last error: %s", err) return func() (data string, err error) {
for _, url := range releaseURLs {
data, err = downloadReleaseURL(url, timeout, mode)
if err == nil {
return data, nil
}
}
return data, fmt.Errorf("Failed to fetch release URL - last error: %s", err)
}()
} }
// parseReleaseData - parses release info file content fetched from // parseReleaseData - parses release info file content fetched from