mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 19:13:34 +00:00
chore: add filter to ListMachines
This commit is contained in:
+1
-1
@@ -305,7 +305,7 @@ func (cli *CLI) AddMachine(
|
||||
}
|
||||
|
||||
// List other machines in the cluster to include them in the join request.
|
||||
machines, err := c.ListMachines(ctx)
|
||||
machines, err := c.ListMachines(ctx, nil)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("list cluster machines: %w", err)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// ExpandCommaSeparatedValues takes a slice of strings and expands any comma-separated values into individual elements.
|
||||
func ExpandCommaSeparatedValues(values []string) []string {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
var expanded []string
|
||||
for _, value := range values {
|
||||
for _, v := range strings.Split(value, ",") {
|
||||
if v = strings.TrimSpace(v); v != "" {
|
||||
expanded = append(expanded, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return expanded
|
||||
}
|
||||
@@ -239,7 +239,7 @@ func (p *Provisioner) WaitClusterReady(ctx context.Context, c Cluster, timeout t
|
||||
), ctx)
|
||||
|
||||
checkMachinesUp := func() error {
|
||||
machines, err := cli.ListMachines(ctx)
|
||||
machines, err := cli.ListMachines(ctx, nil)
|
||||
if err != nil {
|
||||
return fmt.Errorf("list machines: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user