mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00

In preperation for adding the ability to join a machine to an existing cluster force the user to specify whether they expect this to me a new cluster or an active one. The error for not specifying the initial-cluster-state is: ``` etcd: initial cluster state unset and no wal found ```
36 lines
601 B
Go
36 lines
601 B
Go
package etcdserver
|
|
|
|
import (
|
|
"errors"
|
|
)
|
|
|
|
const (
|
|
ClusterStateValueNew = "new"
|
|
)
|
|
|
|
var (
|
|
ClusterStateValues = []string{
|
|
ClusterStateValueNew,
|
|
}
|
|
)
|
|
|
|
// ClusterState implements the flag.Value interface.
|
|
type ClusterState string
|
|
|
|
// Set verifies the argument to be a valid member of ClusterStateFlagValues
|
|
// before setting the underlying flag value.
|
|
func (cs *ClusterState) Set(s string) error {
|
|
for _, v := range ClusterStateValues {
|
|
if s == v {
|
|
*cs = ClusterState(s)
|
|
return nil
|
|
}
|
|
}
|
|
|
|
return errors.New("invalid value")
|
|
}
|
|
|
|
func (cs *ClusterState) String() string {
|
|
return string(*cs)
|
|
}
|