From b76ca5e5742460b9b396904ab3979d3ef7cd60f6 Mon Sep 17 00:00:00 2001 From: Sarthak Jain Date: Tue, 16 Aug 2022 14:50:10 +0530 Subject: [PATCH 1/2] Fixed out of bound issue in describe chaos-scenario command Signed-off-by: Sarthak Jain --- pkg/cmd/describe/workflow.go | 5 +++++ pkg/utils/compatibility.go | 13 +++++++++++++ pkg/utils/constants.go | 13 ------------- 3 files changed, 18 insertions(+), 13 deletions(-) create mode 100644 pkg/utils/compatibility.go diff --git a/pkg/cmd/describe/workflow.go b/pkg/cmd/describe/workflow.go index fba33836..edab1539 100644 --- a/pkg/cmd/describe/workflow.go +++ b/pkg/cmd/describe/workflow.go @@ -69,6 +69,11 @@ var workflowCmd = &cobra.Command{ workflow, err := apis.GetWorkflowList(describeWorkflowRequest, credentials) utils.PrintError(err) + if len(workflow.Data.ListWorkflowDetails.Workflows) == 0 { + utils.Red.Println("⛔ No chaos scenarios found with ID: ", workflowID) + os.Exit(1) + } + yamlManifest, err := yaml.JSONToYAML([]byte(workflow.Data.ListWorkflowDetails.Workflows[0].WorkflowManifest)) if err != nil { utils.Red.Println("❌ Error parsing Chaos Scenario manifest: " + err.Error()) diff --git a/pkg/utils/compatibility.go b/pkg/utils/compatibility.go new file mode 100644 index 00000000..6b4d5f63 --- /dev/null +++ b/pkg/utils/compatibility.go @@ -0,0 +1,13 @@ +package utils + +var ( + // CompatibilityMatrix to store the compatible versions of litmusctl and ChaosCenter + CompatibilityMatrix = map[string][]string{ + "0.6.0": {"2.2.0", "2.3.0"}, + "0.7.0": {"2.4.0", "2.5.0", "2.6.0", "2.7.0", "2.8.0"}, + "0.8.0": {"2.4.0", "2.5.0", "2.6.0", "2.7.0", "2.8.0"}, + "0.9.0": {"2.4.0", "2.5.0", "2.6.0", "2.7.0", "2.8.0"}, + "0.10.0": {"2.10.0", "2.9.0", "2.11.0"}, + "0.11.0": {"2.10.0", "2.9.0", "2.11.0"}, + } +) diff --git a/pkg/utils/constants.go b/pkg/utils/constants.go index 5d11ba4b..b4013d10 100644 --- a/pkg/utils/constants.go +++ b/pkg/utils/constants.go @@ -62,16 +62,3 @@ const ( // Auth server api path AuthAPIPath = "/auth" ) - -var ( - // CompatibilityMatrix to store the compatible versions of litmusctl and ChaosCenter - CompatibilityMatrix = map[string][]string{ - "0.6.0": {"2.2.0", "2.3.0"}, - "0.7.0": {"2.4.0", "2.5.0", "2.6.0", "2.7.0", "2.8.0"}, - "0.8.0": {"2.4.0", "2.5.0", "2.6.0", "2.7.0", "2.8.0"}, - "0.9.0": {"2.4.0", "2.5.0", "2.6.0", "2.7.0", "2.8.0"}, - "0.10.0": {"2.9.0", "2.10.0", "2.11.0", "2.12.0"}, - "0.11.0": {"2.9.0", "2.10.0", "2.11.0", "2.12.0"}, - "0.12.0": {"2.9.0", "2.10.0", "2.11.0", "2.12.0"}, - } -) From 94d481b75fadac945a007e26253da528a9714bad Mon Sep 17 00:00:00 2001 From: Sarthak Jain Date: Tue, 16 Aug 2022 14:58:07 +0530 Subject: [PATCH 2/2] reverted compatibility matrix version changes Signed-off-by: Sarthak Jain --- pkg/utils/compatibility.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/utils/compatibility.go b/pkg/utils/compatibility.go index 6b4d5f63..8d46087e 100644 --- a/pkg/utils/compatibility.go +++ b/pkg/utils/compatibility.go @@ -7,7 +7,8 @@ var ( "0.7.0": {"2.4.0", "2.5.0", "2.6.0", "2.7.0", "2.8.0"}, "0.8.0": {"2.4.0", "2.5.0", "2.6.0", "2.7.0", "2.8.0"}, "0.9.0": {"2.4.0", "2.5.0", "2.6.0", "2.7.0", "2.8.0"}, - "0.10.0": {"2.10.0", "2.9.0", "2.11.0"}, - "0.11.0": {"2.10.0", "2.9.0", "2.11.0"}, + "0.10.0": {"2.9.0", "2.10.0", "2.11.0", "2.12.0"}, + "0.11.0": {"2.9.0", "2.10.0", "2.11.0", "2.12.0"}, + "0.12.0": {"2.9.0", "2.10.0", "2.11.0", "2.12.0"}, } )