Skip to content

Commit

Permalink
fix: missing omitempty on 2 of the new fields (#1389)
Browse files Browse the repository at this point in the history
* fix: missing omitempty on 2 of the new fields

* fix: Rename TS_WORKSPACE_DIR to TS_OUTPUT_DIR

---------

Co-authored-by: Evans Mungai <[email protected]>
  • Loading branch information
cwyl02 and banjoh authored Nov 9, 2023
1 parent f6373f3 commit bc48568
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 15 deletions.
2 changes: 0 additions & 2 deletions config/crds/troubleshoot.sh_hostcollectors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1389,8 +1389,6 @@ spec:
required:
- args
- command
- ignoreParentEnvs
- inheritEnvs
type: object
subnetAvailable:
properties:
Expand Down
2 changes: 0 additions & 2 deletions config/crds/troubleshoot.sh_hostpreflights.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1389,8 +1389,6 @@ spec:
required:
- args
- command
- ignoreParentEnvs
- inheritEnvs
type: object
subnetAvailable:
properties:
Expand Down
2 changes: 0 additions & 2 deletions config/crds/troubleshoot.sh_supportbundles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11720,8 +11720,6 @@ spec:
required:
- args
- command
- ignoreParentEnvs
- inheritEnvs
type: object
subnetAvailable:
properties:
Expand Down
4 changes: 2 additions & 2 deletions examples/collect/host/run-and-save-output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -23,7 +23,7 @@ spec:
dummy.conf: |-
[hello]
hello = 1
[bye]
bye = 2
dummy.yaml: |-
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/troubleshoot/v1beta2/hostcollector_shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/collect/host_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/collect/host_run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
Expand Down
4 changes: 1 addition & 3 deletions schemas/supportbundle-troubleshoot-v1beta2.json
Original file line number Diff line number Diff line change
Expand Up @@ -11472,9 +11472,7 @@
"type": "object",
"required": [
"args",
"command",
"ignoreParentEnvs",
"inheritEnvs"
"command"
],
"properties": {
"args": {
Expand Down

0 comments on commit bc48568

Please sign in to comment.