mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
Provide a friendlier error when an update fails (#8228)
Add upgrading documentation as well
This commit is contained in:
committed by
kannappanr
parent
73e4e99942
commit
9fa727d154
@@ -21,6 +21,7 @@ import (
|
||||
"context"
|
||||
"crypto"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
@@ -521,10 +522,19 @@ func doUpdate(updateURL, sha256Hex, mode string) (err error) {
|
||||
Checksum: sha256Sum,
|
||||
},
|
||||
); err != nil {
|
||||
if os.IsPermission(err) {
|
||||
if rerr := update.RollbackError(err); rerr != nil {
|
||||
return AdminError{
|
||||
Code: AdminUpdateApplyFailure,
|
||||
Message: err.Error(),
|
||||
Message: fmt.Sprintf("Failed to rollback from bad update: %v", rerr),
|
||||
StatusCode: http.StatusInternalServerError,
|
||||
}
|
||||
}
|
||||
var pathErr *os.PathError
|
||||
if errors.As(err, &pathErr) {
|
||||
return AdminError{
|
||||
Code: AdminUpdateApplyFailure,
|
||||
Message: fmt.Sprintf("Unable to update the binary at %s: %v",
|
||||
filepath.Dir(pathErr.Path), pathErr.Err),
|
||||
StatusCode: http.StatusForbidden,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user