Module: Cuken::Api::Chef::DataBag
Instance Method Summary
collapse
#clone_pull_error_check, #with_args
Instance Method Details
#check_data_bag_content_table(table, expect_match = true) ⇒ Object
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/cuken/api/chef/data_bag.rb', line 41
def check_data_bag_content_table(table, expect_match = true)
table.hashes.each do |hsh|
items = data_bag_show(hsh['data_bag'])
if expect_match
items.should include(hsh['item'])
else
items.should_not include(hsh['item'])
end
end
end
|
#check_data_bag_table_presence(table, expect_presence = true) ⇒ Object
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/cuken/api/chef/data_bag.rb', line 30
def check_data_bag_table_presence(table, expect_presence = true)
bags = data_bag_list
table.hashes.each do |hsh|
if expect_presence
bags.should include(hsh['data_bag'])
else
bags.should include(hsh['data_bag'])
end
end
end
|
#data_bag_create(data_bag_name) ⇒ Object
52
53
54
55
56
57
58
|
# File 'lib/cuken/api/chef/data_bag.rb', line 52
def data_bag_create(data_bag_name)
knife_config_file_error_handling()
argv = ['data', 'bag', 'create', data_bag_name]
run_knife(argv)
end
|
#data_bag_list ⇒ Object
70
71
72
73
74
75
76
|
# File 'lib/cuken/api/chef/data_bag.rb', line 70
def data_bag_list
knife_config_file_error_handling()
argv = ['data', 'bag', 'list']
run_knife(argv)
end
|
#data_bag_load(hsh) ⇒ Object
60
61
62
63
64
65
66
67
68
|
# File 'lib/cuken/api/chef/data_bag.rb', line 60
def data_bag_load(hsh)
knife_config_file_error_handling()
ckbk, ckbk_src = parse_to_cookbooks_path(hsh)
full_data_bag_src = find_path_in_cookbook_folders(ckbk, ckbk_src, ckbk, "data_bags/#{hsh['item']}")
argv = ['data', 'bag', 'from', 'file', hsh[:data_bag], full_data_bag_src]
run_knife(argv)
end
|
#data_bag_show(data_bag) ⇒ Object
78
79
80
81
82
83
84
|
# File 'lib/cuken/api/chef/data_bag.rb', line 78
def data_bag_show(data_bag)
knife_config_file_error_handling()
argv = ['data', 'bag', 'show', data_bag]
run_knife(argv)
end
|
#load_data_bag_item_table(table) ⇒ Object
24
25
26
27
28
|
# File 'lib/cuken/api/chef/data_bag.rb', line 24
def load_data_bag_item_table(table)
table.hashes.each do |hsh|
data_bag_load(hsh)
end
end
|