etcd: move s.ClusterConfig to v2_admin.go

release-2.0
Xiang Li 2014-07-16 22:54:58 -07:00 committed by Yicheng Qin
parent da19964959
commit a50857d38a
2 changed files with 11 additions and 10 deletions

View File

@ -160,16 +160,6 @@ func (s *Server) RaftHandler() http.Handler {
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() {
if len(s.config.Peers) == 0 {
s.Bootstrap()

View File

@ -9,6 +9,7 @@ import (
"strconv"
"strings"
"github.com/coreos/etcd/config"
"github.com/coreos/etcd/store"
)
@ -101,6 +102,16 @@ func (s *Server) serveAdminMachines(w http.ResponseWriter, r *http.Request) erro
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.
func (s *Server) someMachineMessage(name string) (*machineMessage, error) {
p := filepath.Join(v2machineKVPrefix, name)