chef-zero 1.1 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -162,7 +162,7 @@ module ChefZero
162
162
  end
163
163
  end
164
164
 
165
- def self.list_directory(directory)
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
- raise DataAlreadyExistsError.new(path + [name])
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, :keep_existing)
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
@@ -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, :keep_existing)
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], item_name, item, :create)
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], :keep_existing)
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
@@ -1,3 +1,3 @@
1
1
  module ChefZero
2
- VERSION = '1.1'
2
+ VERSION = '1.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.1'
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: