Skip to content

Commit

Permalink
rollback keep-tmp-files flag(#693)
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Okhlopkov <[email protected]>
Co-authored-by: Pavel Okhlopkov <[email protected]>
  • Loading branch information
ldmonster and Pavel Okhlopkov authored Dec 2, 2024
1 parent 0b4a0ef commit fc7a47f
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 fc7a47f

Please sign in to comment.