From 19eb2de1c0fe19f188028000786e41eb011042a3 Mon Sep 17 00:00:00 2001 From: Anthony Hinsinger Date: Tue, 28 Nov 2023 18:19:41 +0100 Subject: [PATCH 1/3] Delete connections attribute into passthrough interfaces --- lib/puppet/provider/libvirt_network/virsh.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/puppet/provider/libvirt_network/virsh.rb b/lib/puppet/provider/libvirt_network/virsh.rb index 41a298c..0c044ba 100644 --- a/lib/puppet/provider/libvirt_network/virsh.rb +++ b/lib/puppet/provider/libvirt_network/virsh.rb @@ -93,6 +93,9 @@ def content xml.root.elements.delete('//mac') # remove the connections xml.root.attributes.delete('connections') + xml.root.elements.each("//forward[@mode='passthrough']/interface") do |el| + el.attributes.delete('connections'); + end formatter = REXML::Formatters::Pretty.new(2) formatter.compact = true output = ''.dup From 938d3ef22f150fdad803eb97d6bdcdc0cefdc611 Mon Sep 17 00:00:00 2001 From: Anthony Hinsinger Date: Tue, 28 Nov 2023 19:34:41 +0100 Subject: [PATCH 2/3] Set XPath more generic --- lib/puppet/provider/libvirt_network/virsh.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/provider/libvirt_network/virsh.rb b/lib/puppet/provider/libvirt_network/virsh.rb index 0c044ba..82d33a6 100644 --- a/lib/puppet/provider/libvirt_network/virsh.rb +++ b/lib/puppet/provider/libvirt_network/virsh.rb @@ -93,7 +93,7 @@ def content xml.root.elements.delete('//mac') # remove the connections xml.root.attributes.delete('connections') - xml.root.elements.each("//forward[@mode='passthrough']/interface") do |el| + xml.root.elements.each("//forward/interface[@connections]") do |el| el.attributes.delete('connections'); end formatter = REXML::Formatters::Pretty.new(2) From 64ffbbcce2ae78eef13dadbaf377e2b86b924fc0 Mon Sep 17 00:00:00 2001 From: Anthony Hinsinger Date: Tue, 28 Nov 2023 21:45:25 +0100 Subject: [PATCH 3/3] Fixed pdk code conventions --- lib/puppet/provider/libvirt_network/virsh.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puppet/provider/libvirt_network/virsh.rb b/lib/puppet/provider/libvirt_network/virsh.rb index 82d33a6..957865a 100644 --- a/lib/puppet/provider/libvirt_network/virsh.rb +++ b/lib/puppet/provider/libvirt_network/virsh.rb @@ -93,8 +93,8 @@ def content xml.root.elements.delete('//mac') # remove the connections xml.root.attributes.delete('connections') - xml.root.elements.each("//forward/interface[@connections]") do |el| - el.attributes.delete('connections'); + xml.root.elements.each('//forward/interface[@connections]') do |el| + el.attributes.delete('connections') end formatter = REXML::Formatters::Pretty.new(2) formatter.compact = true