Class: Chef::AttributeBlocklist
- Inherits:
-
Object
- Object
- Chef::AttributeBlocklist
- Defined in:
- lib/chef/attribute_blocklist.rb
Class Method Summary collapse
-
.filter(data, blocklist = nil) ⇒ Object
filter takes two arguments - the data you want to filter, and an array of keys you want discarded.
Class Method Details
.filter(data, blocklist = nil) ⇒ Object
filter takes two arguments - the data you want to filter, and an array of keys you want discarded. You can capture a subtree of the data to filter by providing a “/”-delimited string of keys. If some key includes “/”-characters, you must provide an array of keys instead.
AttributeBlocklist.filter(
{ "filesystem" => {
"/dev/disk" => {
"size" => "10mb"
},
"map - autohome" => {
"size" => "10mb"
}
},
"network" => {
"interfaces" => {
"eth0" => {...},
"eth1" => {...}
}
}
},
["network/interfaces/eth0", ["filesystem", "/dev/disk"]])
will exclude the eth0 and /dev/disk subtrees.
30 31 32 33 34 35 36 37 38 |
# File 'lib/chef/attribute_blocklist.rb', line 30 def self.filter(data, blocklist = nil) return data if blocklist.nil? blocklist.each do |item| Chef::Log.warn("Removing item #{item}") remove_data(data, item) end data end |