Commit 7297369
Adam Mohammed
fix: Properly handle deleting attached Metal VLANs (#967)
Occasionally, we hit some undefined/poorly-defined Metal API behavior
when cleaning up VLANs which have active assignments. The VLAN resource
delete function relies on making a call to
`/metal/v1/virtual-networks/:id?include=instances,virtual_networks,metal_gateway`.
Since each item in the comma-separated list is treated as an individual
entity, if a previous call fetched `instances` without also including
`virutal_networks` partial caching behavior causes the VLAN object that
the provider relies on to only contain an `Href`.
The delete code relied on the full object being there to compare the ID
to the VLAN that is attempting to be deleted. In this PR, I've
introduced `isVlanEqual` that is can compare eithe rthe full VLAN
object, or the light reference.
We'll have to address what the intended behavior is for this partial
caching issue on the Metal API, but for now this addresses problems
experienced in #902.1 file changed
+3
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
236 | 237 | | |
237 | 238 | | |
238 | 239 | | |
239 | | - | |
| 240 | + | |
240 | 241 | | |
241 | 242 | | |
242 | 243 | | |
| |||
255 | 256 | | |
256 | 257 | | |
257 | 258 | | |
258 | | - | |
| 259 | + | |
259 | 260 | | |
260 | 261 | | |
261 | 262 | | |
| |||
0 commit comments