Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/puppet/provider/node_group/https.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ def parent
gindex = $ngs.index { |i| i['name'] == value }
@property_flush['attrs'][property.to_s] = $ngs[gindex]['id']
end
# These 2 attributes are additive, so need to submit nulls to remove unwanted values
elsif [:variables, :classes].include?(property)
@property_flush['attrs'][property.to_s] = add_nulls(@property_hash[property], value)
# For logging return to original intended value
@resource[property] = value.select { |k,v| v != nil }
else
# The to_json function needs to recognize
# booleans true/false, not symbols :true/false
Expand Down Expand Up @@ -172,4 +177,11 @@ def get_id_index_from_name(name)
$ngs.index { |i| i['name'] == name }
end

def add_nulls(current, new)
difference = current.keys - new.keys
nullhash = new
difference.each { |k| nullhash[k] = nil }
nullhash
end

end
12 changes: 12 additions & 0 deletions lib/puppet/provider/node_group/puppetclassify.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ def parent
gindex = $ngs.index { |i| i['name'] == value }
@property_flush['attrs'][property.to_s] = $ngs[gindex]['id']
end
# These 2 attributes are additive, so need to submit nulls to remove unwanted values
elsif [:variables, :classes].include?(property)
@property_flush['attrs'][property.to_s] = add_nulls(@property_hash[property], value)
# For logging return to original intended value
@resource[property] = value.select { |k,v| v != nil }
else
# The to_json function needs to recognize
# booleans true/false, not symbols :true/false
Expand Down Expand Up @@ -189,4 +194,11 @@ def get_id_index_from_name(name)
$ngs.index { |i| i['name'] == name }
end

def add_nulls(current, new)
difference = current.keys - new.keys
nullhash = new
difference.each { |k| nullhash[k] = nil }
nullhash
end

end