mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
bootstrapper: fix GracefulStop of InitServer
Let joinclient stop initserver only when itself initializes the node.
This commit is contained in:
parent
1362e40f53
commit
0232c835ca
@ -148,7 +148,11 @@ func (s *Server) Init(ctx context.Context, req *initproto.InitRequest) (*initpro
|
||||
|
||||
// Stop stops the initialization server gracefully.
|
||||
func (s *Server) Stop() {
|
||||
s.log.Infof("Stopping")
|
||||
|
||||
s.grpcServer.GracefulStop()
|
||||
|
||||
s.log.Infof("Stopped")
|
||||
}
|
||||
|
||||
func (s *Server) setupDisk(masterSecret, salt []byte) error {
|
||||
|
@ -58,6 +58,7 @@ type JoinClient struct {
|
||||
|
||||
dialer grpcDialer
|
||||
joiner ClusterJoiner
|
||||
cleaner cleaner
|
||||
metadataAPI MetadataAPI
|
||||
|
||||
log *logger.Logger
|
||||
@ -100,13 +101,13 @@ func (c *JoinClient) Start(cleaner cleaner) {
|
||||
c.log.Infof("Starting")
|
||||
c.stopC = make(chan struct{}, 1)
|
||||
c.stopDone = make(chan struct{}, 1)
|
||||
c.cleaner = cleaner
|
||||
|
||||
ticker := c.clock.NewTicker(c.interval)
|
||||
go func() {
|
||||
defer ticker.Stop()
|
||||
defer func() { c.stopDone <- struct{}{} }()
|
||||
defer c.log.Infof("Client stopped")
|
||||
defer cleaner.Clean()
|
||||
|
||||
diskUUID, err := c.getDiskUUID()
|
||||
if err != nil {
|
||||
@ -254,6 +255,8 @@ func (c *JoinClient) startNodeAndJoin(ticket *joinproto.IssueJoinTicketResponse,
|
||||
return errors.New("node is already being initialized")
|
||||
}
|
||||
|
||||
c.cleaner.Clean()
|
||||
|
||||
if err := c.updateDiskPassphrase(string(ticket.StateDiskKey)); err != nil {
|
||||
return fmt.Errorf("updating disk passphrase: %w", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user