Просмотр исходного кода

fix(cli): adds better help text.

The zip lib is throwing panics sometimes when the response is malformed.
The cli will now try to download the zip file up to three times before
aborting. The cli gives a better error message and informes the user
about retrying.

closes #4651
bergquist 9 лет назад
Родитель
Сommit
70acfb2cfd
1 измененных файлов с 6 добавлено и 1 удалено
  1. 6 1
      pkg/cmd/grafana-cli/commands/install_command.go

+ 6 - 1
pkg/cmd/grafana-cli/commands/install_command.go

@@ -127,9 +127,14 @@ func downloadFile(pluginName, filePath, url string) (err error) {
 		if r := recover(); r != nil {
 		if r := recover(); r != nil {
 			retryCount++
 			retryCount++
 			if retryCount < 3 {
 			if retryCount < 3 {
-				fmt.Printf("\nFailed downloading. Will retry once.\n%v\n", r)
+
+				fmt.Println("Failed downloading. Will retry once.")
 				downloadFile(pluginName, filePath, url)
 				downloadFile(pluginName, filePath, url)
 			} else {
 			} else {
+				failure := fmt.Sprintf("%v", r)
+				if failure == "runtime error: makeslice: len out of range" {
+					log.Errorf("Failed to extract zipped HTTP response. Please try again.\n")
+				}
 				panic(r)
 				panic(r)
 			}
 			}
 		}
 		}