Skip to content

Commit

Permalink
roll back
Browse files Browse the repository at this point in the history
  • Loading branch information
jt-dd committed Nov 20, 2024
1 parent de201a2 commit 83cd922
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 15 deletions.
3 changes: 0 additions & 3 deletions cmd/kubehound/dumper.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/DataDog/KubeHound/pkg/cmd"
"github.com/DataDog/KubeHound/pkg/config"
"github.com/DataDog/KubeHound/pkg/kubehound/core"
"github.com/DataDog/KubeHound/pkg/telemetry/events"
"github.com/DataDog/KubeHound/pkg/telemetry/log"
"github.com/spf13/cobra"
"github.com/spf13/viper"
Expand Down Expand Up @@ -45,7 +44,6 @@ var (

// Create a temporary directory
tmpDir, err := os.MkdirTemp("", "kubehound")
defer cmd.ReportError(cobraCmd.Context(), events.DumpFinished, err)
if err != nil {
return fmt.Errorf("create temporary directory: %w", err)
}
Expand Down Expand Up @@ -86,7 +84,6 @@ var (
RunE: func(cobraCmd *cobra.Command, args []string) error {
// Passing the Kubehound config from viper
khCfg, err := cmd.GetConfig()
defer cmd.ReportError(cobraCmd.Context(), events.DumpFinished, err)
if err != nil {
return fmt.Errorf("get config: %w", err)
}
Expand Down
2 changes: 0 additions & 2 deletions cmd/kubehound/ingest.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"github.com/DataDog/KubeHound/pkg/cmd"
"github.com/DataDog/KubeHound/pkg/config"
"github.com/DataDog/KubeHound/pkg/kubehound/core"
"github.com/DataDog/KubeHound/pkg/telemetry/events"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down Expand Up @@ -62,7 +61,6 @@ var (
RunE: func(cobraCmd *cobra.Command, args []string) error {
// Passing the Kubehound config from viper
khCfg, err := cmd.GetConfig()
defer cmd.ReportError(cobraCmd.Context(), events.IngestorFailed, err)
if err != nil {
return fmt.Errorf("get config: %w", err)
}
Expand Down
10 changes: 0 additions & 10 deletions pkg/cmd/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

"strings"

"github.com/DataDog/KubeHound/pkg/telemetry/events"
"github.com/DataDog/KubeHound/pkg/telemetry/log"
)

Expand All @@ -30,12 +29,3 @@ func AskForConfirmation(ctx context.Context) (bool, error) {
return AskForConfirmation(ctx)
}
}

func ReportError(ctx context.Context, action events.EventAction, err error) {
l := log.Logger(ctx)
if err != nil {
errMsg := fmt.Errorf("fatal error: %w", err)
l.Error("Error occurred", log.ErrorField(errMsg))
_ = events.PushEvent(ctx, action, fmt.Sprintf("%s", errMsg))
}
}

0 comments on commit 83cd922

Please sign in to comment.