Skip to content

Commit

Permalink
Fixed "index out of bound issue" in describe chaos-scenario command (#90
Browse files Browse the repository at this point in the history
)

* Fixed out of bound issue in describe chaos-scenario command

Signed-off-by: Sarthak Jain <[email protected]>

* reverted compatibility matrix version changes

Signed-off-by: Sarthak Jain <[email protected]>

Signed-off-by: Sarthak Jain <[email protected]>
  • Loading branch information
SarthakJain26 committed Aug 16, 2022
1 parent 7f837ac commit f44e884
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
5 changes: 5 additions & 0 deletions pkg/cmd/describe/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
14 changes: 14 additions & 0 deletions pkg/utils/compatibility.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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.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"},
}
)
13 changes: 0 additions & 13 deletions pkg/utils/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
}
)

0 comments on commit f44e884

Please sign in to comment.