From bc4856869e5a1c70b7742c0f06011ac6c1c20dd2 Mon Sep 17 00:00:00 2001 From: "Weiyanli Chen(York)" <6115189+cwyl02@users.noreply.github.com> Date: Thu, 9 Nov 2023 08:25:11 -0500 Subject: [PATCH] fix: missing omitempty on 2 of the new fields (#1389) * fix: missing omitempty on 2 of the new fields * fix: Rename TS_WORKSPACE_DIR to TS_OUTPUT_DIR --------- Co-authored-by: Evans Mungai --- config/crds/troubleshoot.sh_hostcollectors.yaml | 2 -- config/crds/troubleshoot.sh_hostpreflights.yaml | 2 -- config/crds/troubleshoot.sh_supportbundles.yaml | 2 -- examples/collect/host/run-and-save-output.yaml | 4 ++-- pkg/apis/troubleshoot/v1beta2/hostcollector_shared.go | 4 ++-- pkg/collect/host_run.go | 2 +- pkg/collect/host_run_test.go | 2 +- schemas/supportbundle-troubleshoot-v1beta2.json | 4 +--- 8 files changed, 7 insertions(+), 15 deletions(-) diff --git a/config/crds/troubleshoot.sh_hostcollectors.yaml b/config/crds/troubleshoot.sh_hostcollectors.yaml index 60801398a..3587d0753 100644 --- a/config/crds/troubleshoot.sh_hostcollectors.yaml +++ b/config/crds/troubleshoot.sh_hostcollectors.yaml @@ -1389,8 +1389,6 @@ spec: required: - args - command - - ignoreParentEnvs - - inheritEnvs type: object subnetAvailable: properties: diff --git a/config/crds/troubleshoot.sh_hostpreflights.yaml b/config/crds/troubleshoot.sh_hostpreflights.yaml index 836910682..56a25d433 100644 --- a/config/crds/troubleshoot.sh_hostpreflights.yaml +++ b/config/crds/troubleshoot.sh_hostpreflights.yaml @@ -1389,8 +1389,6 @@ spec: required: - args - command - - ignoreParentEnvs - - inheritEnvs type: object subnetAvailable: properties: diff --git a/config/crds/troubleshoot.sh_supportbundles.yaml b/config/crds/troubleshoot.sh_supportbundles.yaml index b08584b1e..8b0cdb668 100644 --- a/config/crds/troubleshoot.sh_supportbundles.yaml +++ b/config/crds/troubleshoot.sh_supportbundles.yaml @@ -11720,8 +11720,6 @@ spec: required: - args - command - - ignoreParentEnvs - - inheritEnvs type: object subnetAvailable: properties: diff --git a/examples/collect/host/run-and-save-output.yaml b/examples/collect/host/run-and-save-output.yaml index 324741355..6aa2c0be6 100644 --- a/examples/collect/host/run-and-save-output.yaml +++ b/examples/collect/host/run-and-save-output.yaml @@ -10,7 +10,7 @@ spec: # this is for demonstration purpose only -- you probably don't want to drop your input to the bundle! args: - "-c" - - "cat $TS_INPUT_DIR/dummy.yaml > $TS_WORKSPACE_DIR/dummy_content.yaml" + - "cat $TS_INPUT_DIR/dummy.yaml > $TS_OUTPUT_DIR/dummy_content.yaml" outputDir: "myCommandOutputs" env: - AWS_REGION=us-west-1 @@ -23,7 +23,7 @@ spec: dummy.conf: |- [hello] hello = 1 - + [bye] bye = 2 dummy.yaml: |- diff --git a/pkg/apis/troubleshoot/v1beta2/hostcollector_shared.go b/pkg/apis/troubleshoot/v1beta2/hostcollector_shared.go index 08eab484b..33ab971d2 100644 --- a/pkg/apis/troubleshoot/v1beta2/hostcollector_shared.go +++ b/pkg/apis/troubleshoot/v1beta2/hostcollector_shared.go @@ -185,8 +185,8 @@ type HostRun struct { OutputDir string `json:"outputDir,omitempty" yaml:"outputDir,omitempty"` Input map[string]string `json:"input,omitempty" yaml:"input,omitempty"` Env []string `json:"env,omitempty" yaml:"env,omitempty"` - InheritEnvs []string `json:"inheritEnvs" yaml:"inheritEnvs,omitempty"` - IgnoreParentEnvs bool `json:"ignoreParentEnvs" yaml:"ignoreParentEnvs,omitempty"` + InheritEnvs []string `json:"inheritEnvs,omitempty" yaml:"inheritEnvs,omitempty"` + IgnoreParentEnvs bool `json:"ignoreParentEnvs,omitempty" yaml:"ignoreParentEnvs,omitempty"` } type HostCollect struct { diff --git a/pkg/collect/host_run.go b/pkg/collect/host_run.go index a2b7e6fb7..8f674e9df 100644 --- a/pkg/collect/host_run.go +++ b/pkg/collect/host_run.go @@ -80,7 +80,7 @@ func (c *CollectHostRun) Collect(progressChan chan<- interface{}) (map[string][] return nil, errors.New(fmt.Sprintf("failed to create dir for: %s", runHostCollector.OutputDir)) } cmd.Env = append(cmd.Env, - fmt.Sprintf("TS_WORKSPACE_DIR=%s", cmdOutputTempDir), + fmt.Sprintf("TS_OUTPUT_DIR=%s", cmdOutputTempDir), ) } diff --git a/pkg/collect/host_run_test.go b/pkg/collect/host_run_test.go index f415b4d11..6f5321abc 100644 --- a/pkg/collect/host_run_test.go +++ b/pkg/collect/host_run_test.go @@ -117,7 +117,7 @@ func TestCollectHostRun_Collect(t *testing.T) { CollectorName: "my-cmd-with-output", }, Command: "sh", - Args: []string{"-c", "echo ${TS_INPUT_DIR}/dummy.conf > $TS_WORKSPACE_DIR/input-file.txt"}, + Args: []string{"-c", "echo ${TS_INPUT_DIR}/dummy.conf > $TS_OUTPUT_DIR/input-file.txt"}, Input: map[string]string{ "dummy.conf": "[hello]\nhello = 1", }, diff --git a/schemas/supportbundle-troubleshoot-v1beta2.json b/schemas/supportbundle-troubleshoot-v1beta2.json index 320d1d198..90f50a657 100644 --- a/schemas/supportbundle-troubleshoot-v1beta2.json +++ b/schemas/supportbundle-troubleshoot-v1beta2.json @@ -11472,9 +11472,7 @@ "type": "object", "required": [ "args", - "command", - "ignoreParentEnvs", - "inheritEnvs" + "command" ], "properties": { "args": {