mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
main: remove duplicated self name check
This commit is contained in:
parent
f12583c163
commit
aa176610f3
@ -6,6 +6,7 @@ import (
|
||||
"path"
|
||||
|
||||
"github.com/coreos/etcd/pkg/types"
|
||||
"github.com/coreos/etcd/raft"
|
||||
)
|
||||
|
||||
// ServerConfig holds the configuration of etcd as taken from the command line or discovery.
|
||||
@ -28,6 +29,9 @@ func (c *ServerConfig) Verify() error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("could not find name %v in cluster", c.Name)
|
||||
}
|
||||
if m.ID == raft.None {
|
||||
return fmt.Errorf("cannot use None(%x) as member id", raft.None)
|
||||
}
|
||||
|
||||
// No identical IPs in the cluster peer list
|
||||
urlMap := make(map[string]bool)
|
||||
|
12
main.go
12
main.go
@ -14,7 +14,6 @@ import (
|
||||
flagtypes "github.com/coreos/etcd/pkg/flags"
|
||||
"github.com/coreos/etcd/pkg/transport"
|
||||
"github.com/coreos/etcd/proxy"
|
||||
"github.com/coreos/etcd/raft"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -124,17 +123,8 @@ func main() {
|
||||
|
||||
// startEtcd launches the etcd server and HTTP handlers for client/server communication.
|
||||
func startEtcd() {
|
||||
self := cluster.FindName(*name)
|
||||
if self == nil {
|
||||
log.Fatalf("etcd: no member with name=%q exists", *name)
|
||||
}
|
||||
|
||||
if self.ID == raft.None {
|
||||
log.Fatalf("etcd: cannot use None(%d) as member id", raft.None)
|
||||
}
|
||||
|
||||
if *dir == "" {
|
||||
*dir = fmt.Sprintf("%v_etcd_data", self.Name)
|
||||
*dir = fmt.Sprintf("%v_etcd_data", *name)
|
||||
log.Printf("etcd: no data-dir provided, using default data-dir ./%s", *dir)
|
||||
}
|
||||
if err := os.MkdirAll(*dir, privateDirMode); err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user