Skip to content

Commit 27523d0

Browse files
authored
Merge pull request #204 from marquiz/devel/plugin-exit-code
plugins: consistent exit behavior on ttrpc close
2 parents ef2d8cb + 8429b17 commit 27523d0

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

plugins/differ/nri-differ.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ func (p *plugin) RemoveContainer(_ context.Context, pod *api.PodSandbox, contain
257257
}
258258

259259
func (p *plugin) onClose() {
260-
log.Infof("stopped")
261-
os.Exit(0)
260+
log.Infof("Connection to the runtime lost, exiting...")
261+
os.Exit(1)
262262
}
263263

264264
// Dump one or more objects, with an optional global prefix and per-object tags.

plugins/logger/nri-logger.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ func (p *plugin) ValidateContainerAdjustment(_ context.Context, req *api.Validat
177177
}
178178

179179
func (p *plugin) onClose() {
180-
os.Exit(0)
180+
log.Infof("Connection to the runtime lost, exiting...")
181+
os.Exit(1)
181182
}
182183

183184
// Dump one or more objects, with an optional global prefix and per-object tags.

plugins/network-logger/plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func (p *plugin) RemovePodSandbox(_ context.Context, pod *api.PodSandbox) error
7878

7979
func (p *plugin) onClose() {
8080
log.Infof("Connection to the runtime lost, exiting...")
81-
os.Exit(0)
81+
os.Exit(1)
8282
}
8383

8484
func main() {

plugins/template/plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func (p *plugin) RemoveContainer(_ context.Context, pod *api.PodSandbox, ctr *ap
162162

163163
func (p *plugin) onClose() {
164164
log.Infof("Connection to the runtime lost, exiting...")
165-
os.Exit(0)
165+
os.Exit(1)
166166
}
167167

168168
func main() {

plugins/v010-adapter/v010-adapter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func (p *plugin) StopContainer(_ context.Context, pod *api.PodSandbox, ctr *api.
148148

149149
func (p *plugin) onClose() {
150150
log.Infof("Connection to the runtime lost, exiting...")
151-
os.Exit(0)
151+
os.Exit(1)
152152
}
153153

154154
func sandboxFromPod(pod *api.PodSandbox) *nri.Sandbox {

0 commit comments

Comments
 (0)