Skip to content

Commit

Permalink
rollback keep tmp files
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Okhlopkov <[email protected]>
  • Loading branch information
Pavel Okhlopkov committed Nov 29, 2024
1 parent 0b4a0ef commit 5e4b3ff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 1 addition & 5 deletions pkg/app/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ func DefineDebugFlags(kpApp *kingpin.Application, cmd *kingpin.CmdClause) {
cmd.Flag("debug-keep-tmp-files", "set to yes to disable cleanup of temporary files").
Envar("DEBUG_KEEP_TMP_FILES").
Hidden().
Default(DebugKeepTmpFilesVar).Action(func(_ *kingpin.ParseContext) error {
DebugKeepTmpFiles = DebugKeepTmpFilesVar == "yes"

return nil
}).
Default(DebugKeepTmpFilesVar).
StringVar(&DebugKeepTmpFilesVar)

cmd.Flag("debug-kubernetes-api", "enable client-go debug messages").
Expand Down
3 changes: 2 additions & 1 deletion pkg/hook/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/kennygrant/sanitize"
"golang.org/x/time/rate"

"github.com/flant/shell-operator/pkg/app"
"github.com/flant/shell-operator/pkg/executor"
bctx "github.com/flant/shell-operator/pkg/hook/binding_context"
"github.com/flant/shell-operator/pkg/hook/config"
Expand Down Expand Up @@ -124,7 +125,7 @@ func (h *Hook) Run(_ htypes.BindingType, context []bctx.BindingContext, logLabel

// remove tmp file on hook exit
defer func() {
if h.KeepTemporaryHookFiles {
if app.DebugKeepTmpFilesVar != "yes" {
_ = os.Remove(contextPath)
_ = os.Remove(metricsPath)
_ = os.Remove(conversionPath)
Expand Down

0 comments on commit 5e4b3ff

Please sign in to comment.