Parent

Methods

Files

Class/Module Index [+]

Quicksearch

Chef::Whitelist

Public Class Methods

filter(data, whitelist=nil) click to toggle source

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.

# File lib/chef/whitelist.rb, line 30
def self.filter(data, whitelist=nil)
  return data if whitelist.nil?

  new_data = {}
  whitelist.each do |item|
    self.add_data(data, new_data, item)
  end
  new_data
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.