Merge pull request #34 from replicatedhq/error

fail with an error if downloaded bundle doesn't have the version file
This commit is contained in:
divolgin
2019-07-31 10:25:57 -07:00
committed by GitHub
3 changed files with 9 additions and 4 deletions
+2 -2
View File
@@ -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 {
+5
View File
@@ -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
+2 -2
View File
@@ -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"`
}