Преглед изворни кода

etcd: move s.ClusterConfig to v2_admin.go

Xiang Li пре 11 година
родитељ
комит
a50857d38a
2 измењених фајлова са 11 додато и 10 уклоњено
  1. 0 10
      etcd/etcd.go
  2. 11 0
      etcd/v2_admin.go

+ 0 - 10
etcd/etcd.go

@@ -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()

+ 11 - 0
etcd/v2_admin.go

@@ -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)