Skip to content

Commit

Permalink
Merge pull request #34 from replicatedhq/error
Browse files Browse the repository at this point in the history
fail with an error if downloaded bundle doesn't have the version file
  • Loading branch information
divolgin authored Jul 31, 2019
2 parents fa26a5e + a097344 commit 07e79ce
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 07e79ce

Please sign in to comment.