vs_bridge: Ensure existing external ids are updated

... and also the ids not included by the given list are purged.

Closes-Bug: #2043916
Change-Id: I058614b9113edd6e65238b924e5f474cab37946e
This commit is contained in:
Takashi Kajinami 2023-11-19 17:04:11 +09:00
parent fc34b4cd49
commit 0f8e830a09
2 changed files with 12 additions and 3 deletions

View File

@ -47,9 +47,13 @@ Puppet::Type.type(:vs_bridge).provide(:ovs) do
old_ids = _split(get_external_ids(br)) old_ids = _split(get_external_ids(br))
new_ids = _split(value) new_ids = _split(value)
new_ids.each_pair do |k,v| new_ids.each do |k,v|
unless old_ids.has_key?(k) vsctl('br-set-external-id', br, k, v)
vsctl('br-set-external-id', br, k, v) end
old_ids.each do |k, v|
if ! new_ids.has_key?(k)
vsctl('br-set-external-id', br, k)
end end
end end
end end

View File

@ -0,0 +1,5 @@
---
fixes:
- |
The ``vs_bridge`` resource now updates existing keys when external ids are
set. Also, the keys not included by the given extenral ids are removed.