mirror of https://github.com/docker/docs.git
fix error message and typos in swarm cluster
Signed-off-by: allencloud <allen.sun@daocloud.io> (cherry picked from commit 39bc10c36d40677c11a800b4346c5cddec2b997d)
This commit is contained in:
parent
d985acae68
commit
f463560ead
|
@ -82,8 +82,8 @@ type Config struct {
|
||||||
Backend executorpkg.Backend
|
Backend executorpkg.Backend
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cluster provides capabilities to pariticipate in a cluster as worker or a
|
// Cluster provides capabilities to participate in a cluster as a worker or a
|
||||||
// manager and a worker.
|
// manager.
|
||||||
type Cluster struct {
|
type Cluster struct {
|
||||||
sync.RWMutex
|
sync.RWMutex
|
||||||
root string
|
root string
|
||||||
|
@ -411,11 +411,11 @@ func (c *Cluster) Leave(force bool) error {
|
||||||
c.Unlock()
|
c.Unlock()
|
||||||
return fmt.Errorf(msg)
|
return fmt.Errorf(msg)
|
||||||
}
|
}
|
||||||
msg += fmt.Sprintf("Leaving cluster will leave you with %v managers out of %v. This means Raft quorum will be lost and your cluster will become inaccessible. ", reachable-1, reachable+unreachable)
|
msg += fmt.Sprintf("Leaving cluster will leave you with %v managers out of %v. This means Raft quorum will be lost and your cluster will become inaccessible. ", reachable-1, reachable+unreachable)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
msg += "Doing so may lose the consenus of your cluster. "
|
msg += "Doing so may lose the consensus of your cluster. "
|
||||||
}
|
}
|
||||||
|
|
||||||
msg += "Only way to restore a cluster that has lost consensus is to reinitialize it with `--force-new-cluster`. Use `--force` to ignore this message."
|
msg += "Only way to restore a cluster that has lost consensus is to reinitialize it with `--force-new-cluster`. Use `--force` to ignore this message."
|
||||||
|
@ -467,7 +467,7 @@ func (c *Cluster) getRequestContext() context.Context { // TODO: not needed when
|
||||||
return ctx
|
return ctx
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inspect retrives the confuguration properties of managed swarm cluster.
|
// Inspect retrieves the configuration properties of a managed swarm cluster.
|
||||||
func (c *Cluster) Inspect() (types.Swarm, error) {
|
func (c *Cluster) Inspect() (types.Swarm, error) {
|
||||||
c.RLock()
|
c.RLock()
|
||||||
defer c.RUnlock()
|
defer c.RUnlock()
|
||||||
|
@ -520,21 +520,21 @@ func (c *Cluster) Update(version uint64, spec types.Spec) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsManager returns true is Cluster is participating as a manager.
|
// IsManager returns true if Cluster is participating as a manager.
|
||||||
func (c *Cluster) IsManager() bool {
|
func (c *Cluster) IsManager() bool {
|
||||||
c.RLock()
|
c.RLock()
|
||||||
defer c.RUnlock()
|
defer c.RUnlock()
|
||||||
return c.isActiveManager()
|
return c.isActiveManager()
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsAgent returns true is Cluster is participating as a worker/agent.
|
// IsAgent returns true if Cluster is participating as a worker/agent.
|
||||||
func (c *Cluster) IsAgent() bool {
|
func (c *Cluster) IsAgent() bool {
|
||||||
c.RLock()
|
c.RLock()
|
||||||
defer c.RUnlock()
|
defer c.RUnlock()
|
||||||
return c.ready
|
return c.ready
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetListenAddress returns the listening address for current maanger's
|
// GetListenAddress returns the listening address for current manager's
|
||||||
// consensus and dispatcher APIs.
|
// consensus and dispatcher APIs.
|
||||||
func (c *Cluster) GetListenAddress() string {
|
func (c *Cluster) GetListenAddress() string {
|
||||||
c.RLock()
|
c.RLock()
|
||||||
|
@ -545,7 +545,7 @@ func (c *Cluster) GetListenAddress() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRemoteAddress returns a known advertise address of a remote maanger if
|
// GetRemoteAddress returns a known advertise address of a remote manager if
|
||||||
// available.
|
// available.
|
||||||
// todo: change to array/connect with info
|
// todo: change to array/connect with info
|
||||||
func (c *Cluster) GetRemoteAddress() string {
|
func (c *Cluster) GetRemoteAddress() string {
|
||||||
|
@ -695,7 +695,7 @@ func (c *Cluster) CreateService(s types.ServiceSpec) (string, error) {
|
||||||
return r.Service.ID, nil
|
return r.Service.ID, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetService returns a service based on a ID or name.
|
// GetService returns a service based on an ID or name.
|
||||||
func (c *Cluster) GetService(input string) (types.Service, error) {
|
func (c *Cluster) GetService(input string) (types.Service, error) {
|
||||||
c.RLock()
|
c.RLock()
|
||||||
defer c.RUnlock()
|
defer c.RUnlock()
|
||||||
|
@ -786,7 +786,7 @@ func (c *Cluster) GetNodes(options apitypes.NodeListOptions) ([]types.Node, erro
|
||||||
return nodes, nil
|
return nodes, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetNode returns a node based on a ID or name.
|
// GetNode returns a node based on an ID or name.
|
||||||
func (c *Cluster) GetNode(input string) (types.Node, error) {
|
func (c *Cluster) GetNode(input string) (types.Node, error) {
|
||||||
c.RLock()
|
c.RLock()
|
||||||
defer c.RUnlock()
|
defer c.RUnlock()
|
||||||
|
@ -895,7 +895,7 @@ func (c *Cluster) GetTask(input string) (types.Task, error) {
|
||||||
return convert.TaskFromGRPC(*task), nil
|
return convert.TaskFromGRPC(*task), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetNetwork returns a cluster network by ID.
|
// GetNetwork returns a cluster network by an ID.
|
||||||
func (c *Cluster) GetNetwork(input string) (apitypes.NetworkResource, error) {
|
func (c *Cluster) GetNetwork(input string) (apitypes.NetworkResource, error) {
|
||||||
c.RLock()
|
c.RLock()
|
||||||
defer c.RUnlock()
|
defer c.RUnlock()
|
||||||
|
|
Loading…
Reference in New Issue