mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
Move cli/status to internal/statuswaiter
This commit is contained in:
parent
0627b14445
commit
b3a51cca64
@ -15,7 +15,6 @@ import (
|
||||
"github.com/edgelesssys/constellation/cli/internal/cloudcmd"
|
||||
"github.com/edgelesssys/constellation/cli/internal/gcp"
|
||||
"github.com/edgelesssys/constellation/cli/internal/proto"
|
||||
"github.com/edgelesssys/constellation/cli/internal/status"
|
||||
"github.com/edgelesssys/constellation/cli/internal/vpn"
|
||||
"github.com/edgelesssys/constellation/coordinator/atls"
|
||||
"github.com/edgelesssys/constellation/coordinator/pubapi/pubproto"
|
||||
@ -28,6 +27,7 @@ import (
|
||||
"github.com/edgelesssys/constellation/internal/deploy/ssh"
|
||||
"github.com/edgelesssys/constellation/internal/file"
|
||||
"github.com/edgelesssys/constellation/internal/state"
|
||||
"github.com/edgelesssys/constellation/internal/statuswaiter"
|
||||
"github.com/kr/text"
|
||||
wgquick "github.com/nmiculinic/wg-quick-go"
|
||||
"github.com/spf13/afero"
|
||||
@ -58,7 +58,7 @@ func runInitialize(cmd *cobra.Command, args []string) error {
|
||||
fileHandler := file.NewHandler(afero.NewOsFs())
|
||||
vpnHandler := vpn.NewConfigHandler()
|
||||
serviceAccountCreator := cloudcmd.NewServiceAccountCreator()
|
||||
waiter := status.NewWaiter()
|
||||
waiter := statuswaiter.New()
|
||||
protoClient := &proto.Client{}
|
||||
defer protoClient.Close()
|
||||
|
||||
|
@ -14,7 +14,6 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/edgelesssys/constellation/cli/status"
|
||||
"github.com/edgelesssys/constellation/coordinator/atls"
|
||||
"github.com/edgelesssys/constellation/coordinator/attestation/azure"
|
||||
"github.com/edgelesssys/constellation/coordinator/attestation/gcp"
|
||||
@ -22,6 +21,7 @@ import (
|
||||
"github.com/edgelesssys/constellation/coordinator/oid"
|
||||
"github.com/edgelesssys/constellation/coordinator/pubapi/pubproto"
|
||||
"github.com/edgelesssys/constellation/coordinator/state"
|
||||
"github.com/edgelesssys/constellation/internal/statuswaiter"
|
||||
"github.com/spf13/afero"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
@ -44,7 +44,7 @@ func main() {
|
||||
defer cancel()
|
||||
|
||||
// wait for coordinator to come online
|
||||
waiter := status.NewWaiter()
|
||||
waiter := statuswaiter.New()
|
||||
if err := waiter.InitializeValidators([]atls.Validator{
|
||||
azure.NewValidator(map[uint32][]byte{}),
|
||||
gcp.NewValidator(map[uint32][]byte{}),
|
||||
|
@ -1,4 +1,4 @@
|
||||
package status
|
||||
package statuswaiter
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -15,8 +15,6 @@ import (
|
||||
grpcstatus "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// TODO(katexochen): Use protoClient for waiter?
|
||||
|
||||
// Waiter waits for PeerStatusServer to reach a specific state. The waiter needs
|
||||
// to be initialized before usage.
|
||||
type Waiter struct {
|
||||
@ -26,9 +24,9 @@ type Waiter struct {
|
||||
newClient func(cc grpc.ClientConnInterface) pubproto.APIClient
|
||||
}
|
||||
|
||||
// NewWaiter returns a default Waiter with probing inteval of 10 seconds,
|
||||
// New returns a default Waiter with probing inteval of 10 seconds,
|
||||
// attested gRPC connection and PeerStatusClient.
|
||||
func NewWaiter() *Waiter {
|
||||
func New() *Waiter {
|
||||
return &Waiter{
|
||||
interval: 10 * time.Second,
|
||||
newClient: pubproto.NewAPIClient,
|
@ -1,4 +1,4 @@
|
||||
package status
|
||||
package statuswaiter
|
||||
|
||||
import (
|
||||
"context"
|
Loading…
Reference in New Issue
Block a user