Skip to content

Commit a097344

Browse files
committed
fail with an error if downloaded bundle doesnt have the version file
1 parent fa26a5e commit a097344

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

cmd/troubleshoot/cli/version.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99

1010
func writeVersionFile(path string) (string, error) {
1111
version := troubleshootv1beta1.SupportBundleVersion{
12-
ApiVersion: "troubleshoot.replicated.com/v1beta1",
13-
Kind: "SupportBundle",
12+
ApiVersion: "troubleshoot.replicated.com/v1beta1",
13+
Kind: "SupportBundle",
1414
}
1515
b, err := yaml.Marshal(version)
1616
if err != nil {

pkg/analyze/download.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ func DownloadAndAnalyze(ctx context.Context, bundleURL string) ([]*AnalyzeResult
3232
return nil, err
3333
}
3434

35+
_, err = os.Stat(filepath.Join(tmpDir, "version.yaml"))
36+
if err != nil {
37+
return nil, err
38+
}
39+
3540
analyzers, err := getTroubleshootAnalyzers()
3641
if err != nil {
3742
return nil, err
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package v1beta1
22

33
type SupportBundleVersion struct {
4-
ApiVersion string `json:"apiVersion" yaml:"apiVersion"`
5-
Kind string `json:"kind" yaml:"kind"`
4+
ApiVersion string `json:"apiVersion" yaml:"apiVersion"`
5+
Kind string `json:"kind" yaml:"kind"`
66
}

0 commit comments

Comments
 (0)