Skip to content
This repository was archived by the owner on Dec 17, 2021. It is now read-only.

Commit c847ac3

Browse files
committed
commands/ls: Remove SwarmOptions and Swarm from HostListItem struct
1 parent f8c563f commit c847ac3

1 file changed

Lines changed: 1 addition & 34 deletions

File tree

commands/ls.go

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@ import (
2121
"github.com/docker/machine/libmachine/mcndockerclient"
2222
"github.com/docker/machine/libmachine/persist"
2323
"github.com/docker/machine/libmachine/state"
24-
"github.com/docker/machine/libmachine/swarm"
2524
"github.com/skarademir/naturalsort"
2625
)
2726

2827
const (
2928
lsDefaultTimeout = 10
3029
tableFormatKey = "table"
31-
lsDefaultFormat = "table {{ .Name }}\t{{ .Active }}\t{{ .DriverName}}\t{{ .State }}\t{{ .URL }}\t{{ .Swarm }}\t{{ .DockerVersion }}\t{{ .Error}}"
30+
lsDefaultFormat = "table {{ .Name }}\t{{ .Active }}\t{{ .DriverName}}\t{{ .State }}\t{{ .URL }}\t{{ .DockerVersion }}\t{{ .Error}}"
3231
)
3332

3433
var (
@@ -39,8 +38,6 @@ var (
3938
"DriverName": "DRIVER",
4039
"State": "STATE",
4140
"URL": "URL",
42-
"SwarmOptions": "SWARM_OPTIONS",
43-
"Swarm": "SWARM",
4441
"EngineOptions": "ENGINE_OPTIONS",
4542
"Error": "ERRORS",
4643
"DockerVersion": "DOCKER",
@@ -55,8 +52,6 @@ type HostListItem struct {
5552
DriverName string
5653
State state.State
5754
URL string
58-
SwarmOptions *swarm.Options
59-
Swarm string
6055
EngineOptions *engine.Options
6156
Error string
6257
DockerVersion string
@@ -114,32 +109,7 @@ func cmdLs(c CommandLine, api libmachine.API) error {
114109
timeout := time.Duration(c.Int("timeout")) * time.Second
115110
items := getHostListItems(hostList, hostInError, timeout)
116111

117-
swarmMasters := make(map[string]string)
118-
swarmInfo := make(map[string]string)
119-
120-
for _, host := range hostList {
121-
if host.HostOptions != nil {
122-
swarmOptions := host.HostOptions.SwarmOptions
123-
if swarmOptions.Master {
124-
swarmMasters[swarmOptions.Discovery] = host.Name
125-
}
126-
127-
if swarmOptions.Discovery != "" {
128-
swarmInfo[host.Name] = swarmOptions.Discovery
129-
}
130-
}
131-
}
132-
133112
for _, item := range items {
134-
swarmColumn := ""
135-
if item.SwarmOptions != nil && item.SwarmOptions.Discovery != "" {
136-
swarmColumn = swarmMasters[item.SwarmOptions.Discovery]
137-
if item.SwarmOptions.Master {
138-
swarmColumn = fmt.Sprintf("%s (master)", swarmColumn)
139-
}
140-
}
141-
item.Swarm = swarmColumn
142-
143113
if err := template.Execute(w, item); err != nil {
144114
return err
145115
}
@@ -340,10 +310,8 @@ func attemptGetHostState(h *host.Host, stateQueryChan chan<- HostListItem) {
340310
hostError = ""
341311
}
342312

343-
var swarmOptions *swarm.Options
344313
var engineOptions *engine.Options
345314
if h.HostOptions != nil {
346-
swarmOptions = h.HostOptions.SwarmOptions
347315
engineOptions = h.HostOptions.EngineOptions
348316
}
349317

@@ -360,7 +328,6 @@ func attemptGetHostState(h *host.Host, stateQueryChan chan<- HostListItem) {
360328
DriverName: h.Driver.DriverName(),
361329
State: currentState,
362330
URL: url,
363-
SwarmOptions: swarmOptions,
364331
EngineOptions: engineOptions,
365332
DockerVersion: dockerVersion,
366333
Error: hostError,

0 commit comments

Comments
 (0)