chef-zero 1.1 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -162,7 +162,7 @@ module ChefZero
|
|
162
162
|
end
|
163
163
|
end
|
164
164
|
|
165
|
-
def self.
|
165
|
+
def self.list(directory)
|
166
166
|
if directory.is_a?(Hash)
|
167
167
|
directory.keys
|
168
168
|
else
|
@@ -181,7 +181,7 @@ module ChefZero
|
|
181
181
|
def self.load_files(directory, recursive)
|
182
182
|
result = []
|
183
183
|
if directory
|
184
|
-
list(directory) do |child_name|
|
184
|
+
list(directory).each do |child_name|
|
185
185
|
dir = get_directory(directory, child_name)
|
186
186
|
if dir
|
187
187
|
if recursive
|
@@ -52,9 +52,12 @@ module ChefZero
|
|
52
52
|
parent = _get(path, options.include?(:recursive))
|
53
53
|
|
54
54
|
if parent.has_key?(name)
|
55
|
-
|
55
|
+
if !options.include?(:recursive)
|
56
|
+
raise DataAlreadyExistsError.new(path + [name])
|
57
|
+
end
|
58
|
+
else
|
59
|
+
parent[name] = {}
|
56
60
|
end
|
57
|
-
parent[name] = {}
|
58
61
|
end
|
59
62
|
|
60
63
|
def create(path, name, data, *options)
|
@@ -13,7 +13,7 @@ module ChefZero
|
|
13
13
|
elsif exists_data_dir?(request, ['data', name])
|
14
14
|
error(409, "Object already exists")
|
15
15
|
else
|
16
|
-
data_store.create_dir(['data'], name, :
|
16
|
+
data_store.create_dir(['data'], name, :recursive)
|
17
17
|
json_response(201, {"uri" => "#{build_uri(request.base_uri, request.rest_path + [name])}"})
|
18
18
|
end
|
19
19
|
end
|
data/lib/chef_zero/server.rb
CHANGED
@@ -188,9 +188,9 @@ module ChefZero
|
|
188
188
|
end
|
189
189
|
if contents['data']
|
190
190
|
contents['data'].each_pair do |key, data_bag|
|
191
|
-
data_store.create_dir(['data'], key, :
|
191
|
+
data_store.create_dir(['data'], key, :recursive)
|
192
192
|
dejsonize_children(data_bag).each do |item_name, item|
|
193
|
-
data_store.set(['data', key
|
193
|
+
data_store.set(['data', key, item_name], item, :create)
|
194
194
|
end
|
195
195
|
end
|
196
196
|
end
|
@@ -202,7 +202,7 @@ module ChefZero
|
|
202
202
|
cookbook_data = CookbookData.to_hash(cookbook, name_version)
|
203
203
|
end
|
204
204
|
raise "No version specified" if !cookbook_data[:version]
|
205
|
-
data_store.create_dir(['cookbooks'], cookbook_data[:cookbook_name], :
|
205
|
+
data_store.create_dir(['cookbooks'], cookbook_data[:cookbook_name], :recursive)
|
206
206
|
data_store.set(['cookbooks', cookbook_data[:cookbook_name], cookbook_data[:version]], JSON.pretty_generate(cookbook_data), :create)
|
207
207
|
cookbook_data.values.each do |files|
|
208
208
|
next unless files.is_a? Array
|
data/lib/chef_zero/version.rb
CHANGED