Skip to content

Commit

Permalink
fix(cloud): Warn instead of failing when removing
Browse files Browse the repository at this point in the history
When using the '--all' flag when removing instances
warn of the ignored instances and remove the rest,
instead of failing everything.

Signed-off-by: Cezar Craciunoiu <[email protected]>
  • Loading branch information
craciunoiuc committed Sep 19, 2024
1 parent 2478d37 commit 96b1bdb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion internal/cli/kraft/cloud/service/remove/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,17 @@ func Remove(ctx context.Context, opts *RemoveOptions, args ...string) error {
}

args = []string{}
attachedInstances := []string{}
for _, sgItem := range sgList {
args = append(args, sgItem.Name)
if sgItem.Instances != nil && len(sgItem.Instances) > 0 {
attachedInstances = append(attachedInstances, sgItem.Name)
} else {
args = append(args, sgItem.Name)
}
}

if len(attachedInstances) > 0 {
log.G(ctx).Warnf("ignoring %d service(s) as instances are attached: %v", len(attachedInstances), attachedInstances)
}
}

Expand Down

0 comments on commit 96b1bdb

Please sign in to comment.