Top Level Namespace

Defined Under Namespace

Modules: KnifeSolo, Lucene, Search, SearchDbTests, SearchNodeTests Classes: Chef, OperatingSystemNotSupportedError, Query, TestDataBags, TestExplicitSearchDB, TestImplicitSearchDB

Instance Method Summary collapse

Instance Method Details

#build_flat_hash(hsh, prefix = "") ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/knife-solo/resources/patch_cookbooks/chef-solo-search/libraries/search/parser.rb', line 33

def build_flat_hash(hsh, prefix="")
  result = {}
  hsh.each_pair do |key, value|
    if value.kind_of?(Hash)
      result.merge!(build_flat_hash(value, "#{prefix}#{key}_"))
    else
      result[prefix+key] = value
    end
  end
  result
end

#data_bag_item(bag, item) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/knife-solo/resources/patch_cookbooks/chef-solo-search/tests/test_data_bags.rb', line 28

def data_bag_item(bag, item)
  # wrapper around creating a new Recipe instance and calling data_bag on it
  node = Chef::Node.new()
  cookbooks = Chef::CookbookCollection.new()
  run_context = Chef::RunContext.new(node, cookbooks)
  return Chef::Recipe.new("test_cookbook", "test_recipe", run_context).data_bag_item(bag, item)
end