check for bucket exists in 'admin heal' (#3059)

This commit is contained in:
ebozduman
2020-02-01 10:55:13 -08:00
committed by GitHub
parent b70a79e39b
commit ac9b942397
+12
View File
@@ -202,6 +202,18 @@ func mainAdminHeal(ctx *cli.Context) error {
splits := splitStr(aliasedURL, "/", 3)
bucket, prefix := splits[1], splits[2]
clnt, err := newClient(aliasedURL)
if err != nil {
fatalIf(err.Trace(clnt.GetURL().String()), "Unable to create client for URL ", aliasedURL)
return nil
}
for content := range clnt.List(false, false, false, DirNone) {
if content.Err != nil {
fatalIf(content.Err.Trace(clnt.GetURL().String()), "Unable to heal bucket `"+bucket+"`.")
return nil
}
}
// Return the background heal status when the user
// doesn't pass a bucket or --recursive flag.
if bucket == "" && !ctx.Bool("recursive") {