mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
debugd: start existing coordinator binary at boot if coordinator was deployed before reboot
This commit is contained in:
parent
63d282f1ed
commit
5ac72c730d
@ -136,10 +136,24 @@ func (s *ServiceManager) WriteSystemdUnitFile(ctx context.Context, unit SystemdU
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeployDefaultServiceUnit will write the default "constellation.service" unit file.
|
||||
// DeployDefaultServiceUnit will write the default "coordinator.service" unit file.
|
||||
func DeployDefaultServiceUnit(ctx context.Context, serviceManager *ServiceManager) error {
|
||||
return serviceManager.WriteSystemdUnitFile(ctx, SystemdUnit{
|
||||
if err := serviceManager.WriteSystemdUnitFile(ctx, SystemdUnit{
|
||||
Name: debugd.CoordinatorSystemdUnitName,
|
||||
Contents: debugd.CoordinatorSystemdUnitContents,
|
||||
}); err != nil {
|
||||
return fmt.Errorf("writing systemd unit file %q failed: %w", debugd.CoordinatorSystemdUnitName, err)
|
||||
}
|
||||
|
||||
// try to start the default service if the binary exists but ignore failure.
|
||||
// this is meant to start the coordinator after a reboot
|
||||
// if a coordinator binary was uploaded before.
|
||||
if ok, err := afero.Exists(serviceManager.fs, debugd.CoordinatorDeployFilename); ok && err == nil {
|
||||
_ = serviceManager.SystemdAction(ctx, ServiceManagerRequest{
|
||||
Unit: debugd.CoordinatorSystemdUnitName,
|
||||
Action: Start,
|
||||
})
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user