From 0f8e830a093bfc35c1341fc5f6efc97f97992e4e Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sun, 19 Nov 2023 17:04:11 +0900 Subject: [PATCH] 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 --- lib/puppet/provider/vs_bridge/ovs.rb | 10 +++++++--- releasenotes/notes/bug-2043916-069f122907b13bc8.yaml | 5 +++++ 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/bug-2043916-069f122907b13bc8.yaml diff --git a/lib/puppet/provider/vs_bridge/ovs.rb b/lib/puppet/provider/vs_bridge/ovs.rb index 4665af92..223f1760 100644 --- a/lib/puppet/provider/vs_bridge/ovs.rb +++ b/lib/puppet/provider/vs_bridge/ovs.rb @@ -47,9 +47,13 @@ Puppet::Type.type(:vs_bridge).provide(:ovs) do old_ids = _split(get_external_ids(br)) new_ids = _split(value) - new_ids.each_pair do |k,v| - unless old_ids.has_key?(k) - vsctl('br-set-external-id', br, k, v) + new_ids.each do |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 diff --git a/releasenotes/notes/bug-2043916-069f122907b13bc8.yaml b/releasenotes/notes/bug-2043916-069f122907b13bc8.yaml new file mode 100644 index 00000000..b207b8ff --- /dev/null +++ b/releasenotes/notes/bug-2043916-069f122907b13bc8.yaml @@ -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.