3636 "Name" : "NAME" ,
3737 "Active" : "ACTIVE" ,
3838 "ActiveHost" : "ACTIVE_HOST" ,
39- "ActiveSwarm" : "ACTIVE_SWARM" ,
4039 "DriverName" : "DRIVER" ,
4140 "State" : "STATE" ,
4241 "URL" : "URL" ,
@@ -53,7 +52,6 @@ type HostListItem struct {
5352 Name string
5453 Active string
5554 ActiveHost bool
56- ActiveSwarm bool
5755 DriverName string
5856 State state.State
5957 URL string
@@ -349,28 +347,16 @@ func attemptGetHostState(h *host.Host, stateQueryChan chan<- HostListItem) {
349347 engineOptions = h .HostOptions .EngineOptions
350348 }
351349
352- isMaster := false
353- swarmHost := ""
354- if swarmOptions != nil {
355- isMaster = swarmOptions .Master
356- swarmHost = swarmOptions .Host
357- }
358-
359350 activeHost := isActive (currentState , url )
360- activeSwarm := isSwarmActive (currentState , url , isMaster , swarmHost )
361351 active := "-"
362352 if activeHost {
363353 active = "*"
364354 }
365- if activeSwarm {
366- active = "* (swarm)"
367- }
368355
369356 stateQueryChan <- HostListItem {
370357 Name : h .Name ,
371358 Active : active ,
372359 ActiveHost : activeHost ,
373- ActiveSwarm : activeSwarm ,
374360 DriverName : h .Driver .DriverName (),
375361 State : currentState ,
376362 URL : url ,
@@ -457,17 +443,7 @@ func isActive(currentState state.State, hostURL string) bool {
457443 return currentState == state .Running && hostURL == os .Getenv ("DOCKER_HOST" )
458444}
459445
460- func isSwarmActive (currentState state.State , hostURL string , isMaster bool , swarmHost string ) bool {
461- return isMaster && currentState == state .Running && toSwarmURL (hostURL , swarmHost ) == os .Getenv ("DOCKER_HOST" )
462- }
463-
464446func urlPort (urlWithPort string ) string {
465447 parts := strings .Split (urlWithPort , ":" )
466448 return parts [len (parts )- 1 ]
467449}
468-
469- func toSwarmURL (hostURL string , swarmHost string ) string {
470- hostPort := urlPort (hostURL )
471- swarmPort := urlPort (swarmHost )
472- return strings .Replace (hostURL , ":" + hostPort , ":" + swarmPort , 1 )
473- }
0 commit comments