mirror of https://github.com/containerd/nri.git
				
				
				
			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:
		
							parent
							
								
									7548bf8984
								
							
						
					
					
						commit
						8429b178ef
					
				| 
						 | 
				
			
			@ -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.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue