nodeNames contacts the API to get a list of node names. In case of an error, an empty list is returned.
(dockerCLI completion.APIClientProvider, cmd *cobra.Command)
| 225 | // nodeNames contacts the API to get a list of node names. |
| 226 | // In case of an error, an empty list is returned. |
| 227 | func nodeNames(dockerCLI completion.APIClientProvider, cmd *cobra.Command) []string { |
| 228 | res, err := dockerCLI.Client().NodeList(cmd.Context(), client.NodeListOptions{}) |
| 229 | if err != nil { |
| 230 | return []string{} |
| 231 | } |
| 232 | names := make([]string, 0, len(res.Items)) |
| 233 | for _, node := range res.Items { |
| 234 | names = append(names, node.Description.Hostname) |
| 235 | } |
| 236 | return names |
| 237 | } |
| 238 | |
| 239 | // pluginNames contacts the API to get a list of plugin names. |
| 240 | // In case of an error, an empty list is returned. |
no test coverage detected
searching dependent graphs…