From f96311ac8570b3708fdf4c5aa6735b1ba8a8b12f Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Mon, 21 Oct 2024 12:57:19 -0400 Subject: [PATCH] Ensure boolean properties munged The props hash is using symbol keys so the previous behavior was never actually munging and unmunging those boolean values BEFORE: ONBOOT=true AFTER: ONBOOT=yes --- lib/puppet/provider/network_config/redhat.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/puppet/provider/network_config/redhat.rb b/lib/puppet/provider/network_config/redhat.rb index 75b05872..06cc96a8 100644 --- a/lib/puppet/provider/network_config/redhat.rb +++ b/lib/puppet/provider/network_config/redhat.rb @@ -170,7 +170,7 @@ def self.munge(pairs) # For all of the remaining values, blindly toss them into the options hash. props[:options] = pairs - %w[onboot hotplug].each do |bool_property| + %i[onboot hotplug].each do |bool_property| props[bool_property] = (props[bool_property] == 'yes') if props[bool_property] end @@ -214,8 +214,8 @@ def self.format_file(filename, providers) def self.unmunge(props) pairs = {} - %w[onboot hotplug].each do |bool_property| - if props[bool_property] + %i[onboot hotplug].each do |bool_property| + unless props[bool_property].nil? props[bool_property] = (props[bool_property] == true ? 'yes' : 'no') end end