Skip to content

Commit

Permalink
Merge pull request #57 from silinternational/feature/not-all-workspaces
Browse files Browse the repository at this point in the history
don't delete a variable in all workspaces - too dangerous
  • Loading branch information
briskt authored Mar 8, 2023
2 parents 740797f + 1b7d8b7 commit befd91b
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions cmd/variablesDelete.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,13 @@ func runVariablesDelete() {
fmt.Println("Read only mode enabled. No variables will be deleted.")
}

if workspace != "" {
found := deleteWorkspaceVar(organization, workspace, key)
if !found {
errLog.Fatalf("Variable %s not found in workspace %s\n", key, workspace)
}
return
if workspace == "" {
errLog.Fatal("No workspace specified")
}

fmt.Printf("Deleting variables with key '%s' from all workspaces...\n", key)
allWorkspaces, err := lib.GetAllWorkspaces(organization)
if err != nil {
println(err.Error())
return
}

for _, w := range allWorkspaces {
deleteWorkspaceVar(organization, w.Attributes.Name, key)
found := deleteWorkspaceVar(organization, workspace, key)
if !found {
errLog.Fatalf("Variable %s not found in workspace %s\n", key, workspace)
}
return
}
Expand Down

0 comments on commit befd91b

Please sign in to comment.