plugins: consistent exit behavior on ttrpc close

Make those sample plugins which have OnClose defined exit in a similar
fashion, with a log message and exit status 1. This is consistent with
the rest of the sample plugins which also exit with status 1 in this
case (but a different log output).

Signed-off-by: Markus Lehtonen <markus.lehtonen@intel.com>
This commit is contained in:
Markus Lehtonen 2025-08-12 11:58:59 +03:00
parent 7548bf8984
commit 8429b178ef
5 changed files with 7 additions and 6 deletions

View File

@ -257,8 +257,8 @@ func (p *plugin) RemoveContainer(_ context.Context, pod *api.PodSandbox, contain
}
func (p *plugin) onClose() {
log.Infof("stopped")
os.Exit(0)
log.Infof("Connection to the runtime lost, exiting...")
os.Exit(1)
}
// Dump one or more objects, with an optional global prefix and per-object tags.

View File

@ -177,7 +177,8 @@ func (p *plugin) ValidateContainerAdjustment(_ context.Context, req *api.Validat
}
func (p *plugin) onClose() {
os.Exit(0)
log.Infof("Connection to the runtime lost, exiting...")
os.Exit(1)
}
// Dump one or more objects, with an optional global prefix and per-object tags.

View File

@ -78,7 +78,7 @@ func (p *plugin) RemovePodSandbox(_ context.Context, pod *api.PodSandbox) error
func (p *plugin) onClose() {
log.Infof("Connection to the runtime lost, exiting...")
os.Exit(0)
os.Exit(1)
}
func main() {

View File

@ -162,7 +162,7 @@ func (p *plugin) RemoveContainer(_ context.Context, pod *api.PodSandbox, ctr *ap
func (p *plugin) onClose() {
log.Infof("Connection to the runtime lost, exiting...")
os.Exit(0)
os.Exit(1)
}
func main() {

View File

@ -148,7 +148,7 @@ func (p *plugin) StopContainer(_ context.Context, pod *api.PodSandbox, ctr *api.
func (p *plugin) onClose() {
log.Infof("Connection to the runtime lost, exiting...")
os.Exit(0)
os.Exit(1)
}
func sandboxFromPod(pod *api.PodSandbox) *nri.Sandbox {