Decouple ServiceUpdate to ServerUpdate to be more native (#8138)

The change now is to ensure that we take custom URL as
well for updating the deployment, this is required for
hotfix deliveries for certain deployments - other than
the community release.

This commit changes the previous work d65a2c6725
with newer set of requirements.

Also deprecates PeerUptime()
This commit is contained in:
Harshavardhana
2019-08-28 15:04:43 -07:00
committed by GitHub
parent c6f86d35d3
commit 83d4c5763c
16 changed files with 319 additions and 317 deletions

View File

@@ -1,5 +1,5 @@
/*
* MinIO Cloud Storage, (C) 2016, 2017 MinIO, Inc.
* MinIO Cloud Storage, (C) 2016-2019 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,40 +23,10 @@ import (
"net/http"
"net/url"
"strconv"
"time"
trace "github.com/minio/minio/pkg/trace"
)
// ServerVersion - server version
type ServerVersion struct {
Version string `json:"version"`
CommitID string `json:"commitID"`
}
// ServiceUpdateStatus - contains the response of service update API
type ServiceUpdateStatus struct {
CurrentVersion string `json:"currentVersion"`
UpdatedVersion string `json:"updatedVersion"`
}
// ServiceStatus - contains the response of service status API
type ServiceStatus struct {
ServerVersion ServerVersion `json:"serverVersion"`
Uptime time.Duration `json:"uptime"`
}
// ServiceStatus - Returns current server uptime and current
// running version of MinIO server.
func (adm *AdminClient) ServiceStatus() (ss ServiceStatus, err error) {
respBytes, err := adm.serviceCallAction(ServiceActionStatus)
if err != nil {
return ss, err
}
err = json.Unmarshal(respBytes, &ss)
return ss, err
}
// ServiceRestart - restarts the MinIO cluster
func (adm *AdminClient) ServiceRestart() error {
_, err := adm.serviceCallAction(ServiceActionRestart)
@@ -69,28 +39,14 @@ func (adm *AdminClient) ServiceStop() error {
return err
}
// ServiceUpdate - updates and restarts the MinIO cluster to latest version.
func (adm *AdminClient) ServiceUpdate() (us ServiceUpdateStatus, err error) {
respBytes, err := adm.serviceCallAction(ServiceActionUpdate)
if err != nil {
return us, err
}
err = json.Unmarshal(respBytes, &us)
return us, err
}
// ServiceAction - type to restrict service-action values
type ServiceAction string
const (
// ServiceActionStatus represents status action
ServiceActionStatus ServiceAction = "status"
// ServiceActionRestart represents restart action
ServiceActionRestart = "restart"
ServiceActionRestart ServiceAction = "restart"
// ServiceActionStop represents stop action
ServiceActionStop = "stop"
// ServiceActionUpdate represents update action
ServiceActionUpdate = "update"
)
// serviceCallAction - call service restart/update/stop API.