Skip to content

Commit

Permalink
fail with an error if downloaded bundle doesnt have the version file
Browse files Browse the repository at this point in the history
  • Loading branch information
divolgin committed Jul 31, 2019
1 parent fa26a5e commit a097344
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cmd/troubleshoot/cli/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

func writeVersionFile(path string) (string, error) {
version := troubleshootv1beta1.SupportBundleVersion{
ApiVersion: "troubleshoot.replicated.com/v1beta1",
Kind: "SupportBundle",
ApiVersion: "troubleshoot.replicated.com/v1beta1",
Kind: "SupportBundle",
}
b, err := yaml.Marshal(version)
if err != nil {
Expand Down
5 changes: 5 additions & 0 deletions pkg/analyze/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ func DownloadAndAnalyze(ctx context.Context, bundleURL string) ([]*AnalyzeResult
return nil, err
}

_, err = os.Stat(filepath.Join(tmpDir, "version.yaml"))
if err != nil {
return nil, err
}

analyzers, err := getTroubleshootAnalyzers()
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/troubleshoot/v1beta1/version.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package v1beta1

type SupportBundleVersion struct {
ApiVersion string `json:"apiVersion" yaml:"apiVersion"`
Kind string `json:"kind" yaml:"kind"`
ApiVersion string `json:"apiVersion" yaml:"apiVersion"`
Kind string `json:"kind" yaml:"kind"`
}

0 comments on commit a097344

Please sign in to comment.