Browse code

Remove join-tokens from the /info API

join-tokens are not needed for this endpoint, and should not be as part
of /info

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>

Aaron Lehmann authored on 2016/07/28 04:06:00
Showing 5 changed files
... ...
@@ -733,7 +733,10 @@ func (c *Cluster) Info() types.Info {
733 733
 		if err != nil {
734 734
 			info.Error = err.Error()
735 735
 		}
736
-		info.Cluster = swarm
736
+
737
+		// Strip JoinTokens
738
+		info.Cluster = swarm.ClusterInfo
739
+
737 740
 		if r, err := c.client.ListNodes(ctx, &swarmapi.ListNodesRequest{}); err == nil {
738 741
 			info.Nodes = len(r.Nodes)
739 742
 			for _, n := range r.Nodes {
... ...
@@ -13,17 +13,19 @@ import (
13 13
 // SwarmFromGRPC converts a grpc Cluster to a Swarm.
14 14
 func SwarmFromGRPC(c swarmapi.Cluster) types.Swarm {
15 15
 	swarm := types.Swarm{
16
-		ID: c.ID,
17
-		Spec: types.Spec{
18
-			Orchestration: types.OrchestrationConfig{
19
-				TaskHistoryRetentionLimit: c.Spec.Orchestration.TaskHistoryRetentionLimit,
20
-			},
21
-			Raft: types.RaftConfig{
22
-				SnapshotInterval:           c.Spec.Raft.SnapshotInterval,
23
-				KeepOldSnapshots:           c.Spec.Raft.KeepOldSnapshots,
24
-				LogEntriesForSlowFollowers: c.Spec.Raft.LogEntriesForSlowFollowers,
25
-				HeartbeatTick:              c.Spec.Raft.HeartbeatTick,
26
-				ElectionTick:               c.Spec.Raft.ElectionTick,
16
+		ClusterInfo: types.ClusterInfo{
17
+			ID: c.ID,
18
+			Spec: types.Spec{
19
+				Orchestration: types.OrchestrationConfig{
20
+					TaskHistoryRetentionLimit: c.Spec.Orchestration.TaskHistoryRetentionLimit,
21
+				},
22
+				Raft: types.RaftConfig{
23
+					SnapshotInterval:           c.Spec.Raft.SnapshotInterval,
24
+					KeepOldSnapshots:           c.Spec.Raft.KeepOldSnapshots,
25
+					LogEntriesForSlowFollowers: c.Spec.Raft.LogEntriesForSlowFollowers,
26
+					HeartbeatTick:              c.Spec.Raft.HeartbeatTick,
27
+					ElectionTick:               c.Spec.Raft.ElectionTick,
28
+				},
27 29
 			},
28 30
 		},
29 31
 		JoinTokens: types.JoinTokens{
... ...
@@ -60,7 +60,7 @@ clone git golang.org/x/net 2beffdc2e92c8a3027590f898fe88f69af48a3f8 https://gith
60 60
 clone git golang.org/x/sys eb2c74142fd19a79b3f237334c7384d5167b1b46 https://github.com/golang/sys.git
61 61
 clone git github.com/docker/go-units 651fc226e7441360384da338d0fd37f2440ffbe3
62 62
 clone git github.com/docker/go-connections fa2850ff103453a9ad190da0df0af134f0314b3d
63
-clone git github.com/docker/engine-api a52656d77f09d394104c1639824eada038bfdb89
63
+clone git github.com/docker/engine-api 3d1601b9d2436a70b0dfc045a23f6503d19195df
64 64
 clone git github.com/RackSec/srslog 259aed10dfa74ea2961eddd1d9847619f6e98837
65 65
 clone git github.com/imdario/mergo 0.2.1
66 66
 
... ...
@@ -2,11 +2,17 @@ package swarm
2 2
 
3 3
 import "time"
4 4
 
5
-// Swarm represents a swarm.
6
-type Swarm struct {
5
+// ClusterInfo represents info about a the cluster for outputing in "info"
6
+// it contains the same information as "Swarm", but without the JoinTokens
7
+type ClusterInfo struct {
7 8
 	ID string
8 9
 	Meta
9
-	Spec       Spec
10
+	Spec Spec
11
+}
12
+
13
+// Swarm represents a swarm.
14
+type Swarm struct {
15
+	ClusterInfo
10 16
 	JoinTokens JoinTokens
11 17
 }
12 18
 
... ...
@@ -119,7 +125,7 @@ type Info struct {
119 119
 	Nodes          int
120 120
 	Managers       int
121 121
 
122
-	Cluster Swarm
122
+	Cluster ClusterInfo
123 123
 }
124 124
 
125 125
 // Peer represents a peer.
... ...
@@ -256,7 +256,10 @@ type Info struct {
256 256
 	Runtimes           map[string]Runtime
257 257
 	DefaultRuntime     string
258 258
 	Swarm              swarm.Info
259
-	LiveRestore        bool
259
+	// LiveRestoreEnabled determines whether containers should be kept
260
+	// running when the daemon is shutdown or upon daemon start if
261
+	// running containers are detected
262
+	LiveRestoreEnabled bool
260 263
 }
261 264
 
262 265
 // PluginsInfo is a temp struct holding Plugins name