Class: Chef::Whitelist
- Inherits:
-
Object
- Object
- Chef::Whitelist
- Defined in:
- lib/chef/whitelist.rb
Class Method Summary collapse
-
.filter(data, whitelist = nil) ⇒ Object
filter takes two arguments - the data you want to filter, and a whitelisted array of keys you want included.
Class Method Details
.filter(data, whitelist = nil) ⇒ Object
filter takes two arguments - the data you want to filter, and a whitelisted array of keys you want included. 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.
Whitelist.filter(
{ "filesystem" => {
"/dev/disk" => {
"size" => "10mb"
},
"map - autohome" => {
"size" => "10mb"
}
},
"network" => {
"interfaces" => {
"eth0" => {...},
"eth1" => {...}
}
}
},
["network/interfaces/eth0", ["filesystem", "/dev/disk"]])
will capture the eth0 and /dev/disk subtrees.
30 31 32 33 34 35 36 37 38 |
# File 'lib/chef/whitelist.rb', line 30 def self.filter(data, whitelist = nil) return data if whitelist.nil? new_data = {} whitelist.each do |item| add_data(data, new_data, item) end new_data end |