mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-04-26 18:19:32 -04:00
cli: add output before long-running actions
This commit is contained in:
parent
daf2280e3f
commit
7315e80374
@ -9,10 +9,6 @@ import (
|
||||
"io/fs"
|
||||
"net"
|
||||
|
||||
"github.com/spf13/afero"
|
||||
"github.com/spf13/cobra"
|
||||
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
||||
|
||||
"github.com/edgelesssys/constellation/cli/azure"
|
||||
"github.com/edgelesssys/constellation/cli/file"
|
||||
"github.com/edgelesssys/constellation/cli/gcp"
|
||||
@ -23,6 +19,10 @@ import (
|
||||
"github.com/edgelesssys/constellation/coordinator/util"
|
||||
"github.com/edgelesssys/constellation/internal/config"
|
||||
"github.com/edgelesssys/constellation/internal/state"
|
||||
"github.com/kr/text"
|
||||
"github.com/spf13/afero"
|
||||
"github.com/spf13/cobra"
|
||||
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
||||
)
|
||||
|
||||
func newInitCmd() *cobra.Command {
|
||||
@ -94,6 +94,7 @@ func initialize(ctx context.Context, cmd *cobra.Command, protCl protoClient, vpn
|
||||
}
|
||||
}
|
||||
|
||||
cmd.Println("Creating service account ...")
|
||||
serviceAccount, stat, err := serviceAccountCr.createServiceAccount(ctx, stat, config)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -108,6 +109,7 @@ func initialize(ctx context.Context, cmd *cobra.Command, protCl protoClient, vpn
|
||||
}
|
||||
|
||||
endpoints := ipsToEndpoints(append(coordinators.PublicIPs(), nodes.PublicIPs()...), *config.CoordinatorPort)
|
||||
cmd.Println("Waiting for cloud provider to finish resource creation ...")
|
||||
if err := waiter.WaitForAll(ctx, endpoints, coordinatorstate.AcceptingInit); err != nil {
|
||||
return fmt.Errorf("failed to wait for peer status: %w", err)
|
||||
}
|
||||
@ -158,7 +160,9 @@ func activate(ctx context.Context, cmd *cobra.Command, client protoClient, input
|
||||
return activationResult{}, err
|
||||
}
|
||||
|
||||
if err := respCl.WriteLogStream(cmd.OutOrStdout()); err != nil {
|
||||
indentOut := text.NewIndentWriter(cmd.OutOrStdout(), []byte{'\t'})
|
||||
cmd.Println("Activating the cluster ...")
|
||||
if err := respCl.WriteLogStream(indentOut); err != nil {
|
||||
return activationResult{}, err
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,8 @@ func terminate(cmd *cobra.Command, fileHandler file.Handler, config *config.Conf
|
||||
return err
|
||||
}
|
||||
|
||||
cmd.Println("Terminating ...")
|
||||
|
||||
if len(stat.EC2Instances) != 0 || stat.EC2SecurityGroup != "" {
|
||||
ec2client, err := ec2.NewFromDefault(cmd.Context())
|
||||
if err != nil {
|
||||
|
1
go.mod
1
go.mod
@ -71,6 +71,7 @@ require (
|
||||
github.com/google/uuid v1.3.0
|
||||
github.com/googleapis/gax-go/v2 v2.2.0
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
|
||||
github.com/kr/text v0.2.0
|
||||
github.com/martinjungblut/go-cryptsetup v0.0.0-20220317181052-e70d6b615049
|
||||
github.com/schollz/progressbar/v3 v3.8.6
|
||||
github.com/spf13/afero v1.8.2
|
||||
|
Loading…
x
Reference in New Issue
Block a user