Skip to content

Commit f8b544d

Browse files
authored
Delete workloads before volumesets on GVC deletion (#245)
1 parent 4c4f5ea commit f8b544d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ _Please add entries here for your pull requests that have not yet been released.
2020

2121
- Fixed potential infinite loop that could occur for a command if one of the execution steps fails and gets stuck. [PR 217](https://github.com/shakacode/control-plane-flow/pull/217) by [Zakir Dzhamaliddinov](https://github.com/zzaakiirr).
2222

23+
- Fixed issue where app cannot be deleted because one of the workloads has a volumeset in-use. [PR 245](https://github.com/shakacode/control-plane-flow/pull/245) by [Zakir Dzhamaliddinov](https://github.com/zzaakiirr).
24+
2325
## [4.0.0] - 2024-08-21
2426

2527
### Fixed

lib/command/delete.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ def delete_workload(workload)
106106
def delete_volumesets
107107
@volumesets.each do |volumeset|
108108
step("Deleting volumeset '#{volumeset['name']}' from app '#{config.app}'") do
109-
# If the volumeset is attached to a workload, we need to delete the workload first
110-
workload = volumeset.dig("status", "usedByWorkload")&.split("/")&.last
111-
cp.delete_workload(workload) if workload
109+
# If the volumeset is attached to workloads, we need to delete the workloads first
110+
workloads = volumeset.dig("status", "workloadLinks")&.map { |workload_link| workload_link.split("/").last }
111+
workloads&.each { |workload| cp.delete_workload(workload) }
112112

113113
cp.delete_volumeset(volumeset["name"])
114114
end

0 commit comments

Comments
 (0)