Skip to content

Commit

Permalink
added chaos experiment ID in save experiment command (#245)
Browse files Browse the repository at this point in the history
Signed-off-by: Sarthak Jain <[email protected]>
  • Loading branch information
SarthakJain26 authored Jul 15, 2024
1 parent fd531ae commit a422a8a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pkg/cmd/save/experiment.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ import (
models "github.com/litmuschaos/litmus/chaoscenter/graphql/server/graph/model"
"github.com/litmuschaos/litmusctl/pkg/apis/experiment"

//"time"

//"github.com/gorhill/cronexpr"
"github.com/litmuschaos/litmusctl/pkg/apis"
"github.com/litmuschaos/litmusctl/pkg/utils"

Expand Down Expand Up @@ -123,21 +120,22 @@ var experimentCmd = &cobra.Command{
if (saveExperiment.Data == experiment.SavedExperimentDetails{}) {

if strings.Contains(err.Error(), "multiple write errors") {
utils.Red.Println("\n❌ Chaos Experiment/" + chaosExperimentRequest.Name + " already exists")
utils.Red.Println("\n❌ Chaos Experiment " + chaosExperimentRequest.Name + " already exists")
os.Exit(1)
}
if strings.Contains(err.Error(), "no documents in result") {
utils.Red.Println("❌ The specified Project ID or Chaos Infrastructure ID doesn't exist.")
os.Exit(1)
} else {
utils.White_B.Print("\n❌ Chaos Experiment/" + chaosExperimentRequest.Name + " failed to be created: " + err.Error())
utils.White_B.Print("\n❌ Chaos Experiment " + chaosExperimentRequest.Name + " failed to be created: " + err.Error())
os.Exit(1)
}
}
}

//Successful creation
utils.White_B.Println("\n🚀 Chaos Experiment/" + chaosExperimentRequest.Name + " successfully saved 🎉")
utils.White_B.Println("\n🚀 Chaos Experiment " + chaosExperimentRequest.Name + " successfully saved 🎉")
utils.White_B.Println("\nChaos Experiment ID: " + chaosExperimentRequest.ID)
},
}

Expand Down

0 comments on commit a422a8a

Please sign in to comment.