m/c/metroctl: implement the "list" command
list prints node IDs of existing nodes.
If no positional arguments are passed, or the only positional argument
equals "all", all existing nodes will be processed.
Otherwise, if any positional arguments are used, the output set will
be limited to node IDs matching the positional arguments. Nonexistent
nodes will not be listed.
The node set can be further narrowed with an optional CEL node filter
expression, set with the new --filter flag.
The output format can be adjusted using the --format (-f) flag.
Currently, only plaintext output is available.
The output will be saved to a file, if a path is specified with the
--output (-o) flag.
Change-Id: I44d57ad52805924673354c70e54cd299a88ad75f
Reviewed-on: https://review.monogon.dev/c/monogon/+/848
Tested-by: Jenkins CI
Reviewed-by: Sergiusz Bazanski <serge@monogon.tech>
diff --git a/metropolis/cli/metroctl/rpc.go b/metropolis/cli/metroctl/rpc.go
index a050e9b..d1719ee 100644
--- a/metropolis/cli/metroctl/rpc.go
+++ b/metropolis/cli/metroctl/rpc.go
@@ -7,22 +7,19 @@
"google.golang.org/grpc"
"source.monogon.dev/metropolis/cli/metroctl/core"
- clicontext "source.monogon.dev/metropolis/cli/pkg/context"
)
-func dialAuthenticated() *grpc.ClientConn {
- if len(flags.clusterEndpoints) == 0 {
- log.Fatal("Please provide at least one cluster endpoint using the --endpoint parameter.")
- }
+func dialAuthenticated(ctx context.Context) *grpc.ClientConn {
// Collect credentials, validate command parameters, and try dialing the
// cluster.
ocert, opkey, err := getCredentials()
if err == noCredentialsError {
log.Fatalf("You have to take ownership of the cluster first: %v", err)
}
-
- ctx := clicontext.WithInterrupt(context.Background())
+ if len(flags.clusterEndpoints) == 0 {
+ log.Fatal("Please provide at least one cluster endpoint using the --endpoint parameter.")
+ }
cc, err := core.DialCluster(ctx, opkey, ocert, flags.proxyAddr, flags.clusterEndpoints, rpcLogger)
if err != nil {
log.Fatalf("While dialing the cluster: %v", err)