Skip to content

Commit

Permalink
don't delete a variable in all workspaces - too dangerous
Browse files Browse the repository at this point in the history
  • Loading branch information
briskt committed Mar 8, 2023
1 parent 740797f commit 1b7d8b7
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 1b7d8b7

Please sign in to comment.