File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
lib/puppet/provider/node_group Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,11 @@ def parent
137137 gindex = $ngs. index { |i | i [ 'name' ] == value }
138138 @property_flush [ 'attrs' ] [ property . to_s ] = $ngs[ gindex ] [ 'id' ]
139139 end
140+ # These 2 attributes are additive, so need to submit nulls to remove unwanted values
141+ elsif [ :variables , :classes ] . include? ( property )
142+ @property_flush [ 'attrs' ] [ property . to_s ] = add_nulls ( @property_hash [ property ] , value )
143+ # For logging return to original intended value
144+ @resource [ property ] = value . select { |k , v | v != nil }
140145 else
141146 # The to_json function needs to recognize
142147 # booleans true/false, not symbols :true/false
@@ -172,4 +177,11 @@ def get_id_index_from_name(name)
172177 $ngs. index { |i | i [ 'name' ] == name }
173178 end
174179
180+ def add_nulls ( current , new )
181+ difference = current . keys - new . keys
182+ nullhash = new
183+ difference . each { |k | nullhash [ k ] = nil }
184+ nullhash
185+ end
186+
175187end
Original file line number Diff line number Diff line change @@ -148,6 +148,11 @@ def parent
148148 gindex = $ngs. index { |i | i [ 'name' ] == value }
149149 @property_flush [ 'attrs' ] [ property . to_s ] = $ngs[ gindex ] [ 'id' ]
150150 end
151+ # These 2 attributes are additive, so need to submit nulls to remove unwanted values
152+ elsif [ :variables , :classes ] . include? ( property )
153+ @property_flush [ 'attrs' ] [ property . to_s ] = add_nulls ( @property_hash [ property ] , value )
154+ # For logging return to original intended value
155+ @resource [ property ] = value . select { |k , v | v != nil }
151156 else
152157 # The to_json function needs to recognize
153158 # booleans true/false, not symbols :true/false
@@ -189,4 +194,11 @@ def get_id_index_from_name(name)
189194 $ngs. index { |i | i [ 'name' ] == name }
190195 end
191196
197+ def add_nulls ( current , new )
198+ difference = current . keys - new . keys
199+ nullhash = new
200+ difference . each { |k | nullhash [ k ] = nil }
201+ nullhash
202+ end
203+
192204end
You can’t perform that action at this time.
0 commit comments