Skip to content

Commit b0ec3af

Browse files
miltalexteo
authored andcommitted
[coconut] add force flag in environment destroy
1 parent 9160e14 commit b0ec3af

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

coconut/cmd/environment_destroy.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,5 @@ func init() {
5151

5252
environmentDestroyCmd.Flags().BoolP("keep-tasks", "k", false, "keep tasks active after destroying the environment")
5353
environmentDestroyCmd.Flags().BoolP("allow-in-running-state", "a", false, "allows destroying an environment while in Running state")
54+
environmentDestroyCmd.Flags().BoolP("force", "f", false, "force destroy of an environment")
5455
}

coconut/control/control.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,12 @@ func DestroyEnvironment(cxt context.Context, rpc *coconut.RpcClient, cmd *cobra.
499499
keepTasks = false
500500
}
501501

502-
_, err = rpc.DestroyEnvironment(cxt, &pb.DestroyEnvironmentRequest{Id: envId, KeepTasks: keepTasks, AllowInRunningState: allowInRunningState}, grpc.EmptyCallOption{})
502+
force, err := cmd.Flags().GetBool("force")
503+
if err != nil {
504+
keepTasks = false
505+
}
506+
507+
_, err = rpc.DestroyEnvironment(cxt, &pb.DestroyEnvironmentRequest{Id: envId, KeepTasks: keepTasks, AllowInRunningState: allowInRunningState, Force: force}, grpc.EmptyCallOption{})
503508
if err != nil {
504509
return
505510
}

0 commit comments

Comments
 (0)