Skip to content

Commit 8e1f31f

Browse files
committed
Log the error when removing the working dir fails
os.RemoveAll can return an error; even if we're exiting the procedure at the time, it's worth knowing when it's failing, because typically the working directory is a memory-backed volume and you can run out quite easily. Signed-off-by: Michael Bridgen <[email protected]>
1 parent f82654d commit 8e1f31f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

controllers/imageupdateautomation_controller.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,11 @@ func (r *ImageUpdateAutomationReconciler) Reconcile(ctx context.Context, req ctr
215215
if err != nil {
216216
return failWithError(err)
217217
}
218-
defer os.RemoveAll(tmp)
218+
defer func() {
219+
if err := os.RemoveAll(tmp); err != nil {
220+
log.Error(err, "failed to remove working directory", "path", tmp)
221+
}
222+
}()
219223

220224
// FIXME use context with deadline for at least the following ops
221225

0 commit comments

Comments
 (0)