From 68631c5e4edf2149cf9dcb6a681f531a07c35f74 Mon Sep 17 00:00:00 2001 From: Taimoor Ahmad Date: Fri, 5 Jan 2024 15:40:33 -0500 Subject: [PATCH] remove harmful defaults set calls --- .changes/unreleased/Bugfix-20240105-154208.yaml | 3 +++ src/cmd/check.go | 4 ---- src/cmd/infra.go | 7 ------- 3 files changed, 3 insertions(+), 11 deletions(-) create mode 100644 .changes/unreleased/Bugfix-20240105-154208.yaml diff --git a/.changes/unreleased/Bugfix-20240105-154208.yaml b/.changes/unreleased/Bugfix-20240105-154208.yaml new file mode 100644 index 00000000..abd28f16 --- /dev/null +++ b/.changes/unreleased/Bugfix-20240105-154208.yaml @@ -0,0 +1,3 @@ +kind: Bugfix +body: Fix bug in Infra where unexpected data would be included in requests +time: 2024-01-05T15:42:08.827698-05:00 diff --git a/src/cmd/check.go b/src/cmd/check.go index a2b696bc..8b7fb643 100644 --- a/src/cmd/check.go +++ b/src/cmd/check.go @@ -6,7 +6,6 @@ import ( "github.com/opslevel/opslevel-go/v2023" - "github.com/creasty/defaults" "github.com/opslevel/cli/common" "github.com/rs/zerolog/log" "github.com/spf13/cobra" @@ -466,8 +465,5 @@ func readCheckInput() (*CheckInputType, error) { // Unmarshall evt := &CheckInputType{} viper.Unmarshal(&evt) - if err := defaults.Set(evt); err != nil { - return nil, err - } return evt, nil } diff --git a/src/cmd/infra.go b/src/cmd/infra.go index f06f3460..faa5bf25 100644 --- a/src/cmd/infra.go +++ b/src/cmd/infra.go @@ -8,7 +8,6 @@ import ( "os" "strings" - "github.com/creasty/defaults" "github.com/opslevel/cli/common" "github.com/opslevel/opslevel-go/v2023" "github.com/rs/zerolog/log" @@ -249,11 +248,5 @@ func readInfraInput() (*opslevel.InfraInput, error) { cobra.CheckErr(err) evt := &opslevel.InfraInput{} cobra.CheckErr(yaml.Unmarshal(file, &evt)) - log.Info().Msgf("before %s %s %+v +%v\n", evt.Schema, *evt.Owner, evt.Provider, evt.Data) - if err := defaults.Set(evt); err != nil { - return nil, err - } - log.Info().Msgf("after %s %s %+v +%v\n", evt.Schema, *evt.Owner, evt.Provider, evt.Data) - panic("bye") return evt, nil }