@@ -67,7 +67,6 @@ type HostListItem struct {
6767
6868// FilterOptions -
6969type FilterOptions struct {
70- SwarmName []string
7170 DriverName []string
7271 State []string
7372 Name []string
@@ -186,8 +185,6 @@ func parseFilters(filters []string) (FilterOptions, error) {
186185 key , value := strings .ToLower (kv [0 ]), kv [1 ]
187186
188187 switch key {
189- case "swarm" :
190- options .SwarmName = append (options .SwarmName , value )
191188 case "driver" :
192189 options .DriverName = append (options .DriverName , value )
193190 case "state" :
@@ -204,19 +201,17 @@ func parseFilters(filters []string) (FilterOptions, error) {
204201}
205202
206203func filterHosts (hosts []* host.Host , filters FilterOptions ) []* host.Host {
207- if len (filters .SwarmName ) == 0 &&
208- len (filters .DriverName ) == 0 &&
204+ if len (filters .DriverName ) == 0 &&
209205 len (filters .State ) == 0 &&
210206 len (filters .Name ) == 0 &&
211207 len (filters .Labels ) == 0 {
212208 return hosts
213209 }
214210
215211 filteredHosts := []* host.Host {}
216- swarmMasters := getSwarmMasters (hosts )
217212
218213 for _ , h := range hosts {
219- if filterHost (h , filters , swarmMasters ) {
214+ if filterHost (h , filters ) {
220215 filteredHosts = append (filteredHosts , h )
221216 }
222217 }
@@ -236,14 +231,13 @@ func getSwarmMasters(hosts []*host.Host) map[string]string {
236231 return swarmMasters
237232}
238233
239- func filterHost (host * host.Host , filters FilterOptions , swarmMasters map [string ]string ) bool {
240- swarmMatches := matchesSwarmName (host , filters .SwarmName , swarmMasters )
234+ func filterHost (host * host.Host , filters FilterOptions ) bool {
241235 driverMatches := matchesDriverName (host , filters .DriverName )
242236 stateMatches := matchesState (host , filters .State )
243237 nameMatches := matchesName (host , filters .Name )
244238 labelMatches := matchesLabel (host , filters .Labels )
245239
246- return swarmMatches && driverMatches && stateMatches && nameMatches && labelMatches
240+ return driverMatches && stateMatches && nameMatches && labelMatches
247241}
248242
249243func matchesSwarmName (host * host.Host , swarmNames []string , swarmMasters map [string ]string ) bool {
0 commit comments