mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcd: move s.ClusterConfig to v2_admin.go
This commit is contained in:
parent
da19964959
commit
a50857d38a
10
etcd/etcd.go
10
etcd/etcd.go
@ -160,16 +160,6 @@ func (s *Server) RaftHandler() http.Handler {
|
|||||||
return s.rh
|
return s.rh
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) ClusterConfig() *config.ClusterConfig {
|
|
||||||
c := config.NewClusterConfig()
|
|
||||||
// This is used for backward compatibility because it doesn't
|
|
||||||
// set cluster config in older version.
|
|
||||||
if e, err := s.Get(v2configKVPrefix, false, false); err == nil {
|
|
||||||
json.Unmarshal([]byte(*e.Node.Value), c)
|
|
||||||
}
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Server) Run() {
|
func (s *Server) Run() {
|
||||||
if len(s.config.Peers) == 0 {
|
if len(s.config.Peers) == 0 {
|
||||||
s.Bootstrap()
|
s.Bootstrap()
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/coreos/etcd/config"
|
||||||
"github.com/coreos/etcd/store"
|
"github.com/coreos/etcd/store"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -101,6 +102,16 @@ func (s *Server) serveAdminMachines(w http.ResponseWriter, r *http.Request) erro
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Server) ClusterConfig() *config.ClusterConfig {
|
||||||
|
c := config.NewClusterConfig()
|
||||||
|
// This is used for backward compatibility because it doesn't
|
||||||
|
// set cluster config in older version.
|
||||||
|
if e, err := s.Get(v2configKVPrefix, false, false); err == nil {
|
||||||
|
json.Unmarshal([]byte(*e.Node.Value), c)
|
||||||
|
}
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
// someMachineMessage return machine message of specified name.
|
// someMachineMessage return machine message of specified name.
|
||||||
func (s *Server) someMachineMessage(name string) (*machineMessage, error) {
|
func (s *Server) someMachineMessage(name string) (*machineMessage, error) {
|
||||||
p := filepath.Join(v2machineKVPrefix, name)
|
p := filepath.Join(v2machineKVPrefix, name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user