chef-zero 4.4.0 → 4.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef05ae4a7aef9de3c3a3da1ec5fbd5143a1a0457
4
- data.tar.gz: 01e350ee9b6ff42d42550e8bafa07e1de7d1d629
3
+ metadata.gz: 6d28e6a6bda690839d80bd54dce06e9e4bf320fe
4
+ data.tar.gz: 1858dce1cfdb1a48af5104b29352937ac9fb6138
5
5
  SHA512:
6
- metadata.gz: ac2bff1a5f4518d05262d3660ad96709ec60f495706bd0700d4084cdc1a6e14cca17a458a69067bf5da9a14024c7222a17e0bb8de2a582205d9ebe0acbd560e6
7
- data.tar.gz: 727e1693591ff8b7e7c03c3fd9b0e57868429fe9c1286b8b59cb65850d54b8d90cf54e6bc2a9c4353c1f1cff5081e7853400be21ef50ac1cd98b0bc2ff63a1cb
6
+ metadata.gz: 47705c89adc13d890d9d2454ad3fb4c0d1d451f57a91a593d4c5a31c29b94f06026abc93dbf8a1e73f2931c592833f80e853d6e86cb8a3c22f6e0da13ed1b13c
7
+ data.tar.gz: 6ae3097039e28c17ceded5a7811b8179c33392c22650450936225e6c81c2af343aceafa75c662862f9565b9f9718d87bf126ac8e4b50124b4de96e761c040338
@@ -125,8 +125,8 @@ module ChefZero
125
125
  end
126
126
  end
127
127
 
128
- def cookbook_artifact(name, data, &block)
129
- before(chef_server_options[:server_scope]) { cookbook_artifact(name, data, &block) }
128
+ def cookbook_artifact(name, identifier, data = {}, &block)
129
+ before(chef_server_options[:server_scope]) { cookbook_artifact(name, identifier, data, &block) }
130
130
  end
131
131
 
132
132
  def data_bag(name, data, &block)
@@ -215,6 +215,8 @@ module ChefZero
215
215
 
216
216
  def cookbook(name, version, data = {}, options = {}, &block)
217
217
  with_object_path("cookbooks/#{name}") do
218
+ # If you didn't specify metadata.rb, we generate it for you. If you
219
+ # explicitly set it to nil, that means you don't want it at all.
218
220
  if data.has_key?('metadata.rb')
219
221
  if data['metadata.rb'].nil?
220
222
  data.delete('metadata.rb')
@@ -227,9 +229,18 @@ module ChefZero
227
229
  end
228
230
  end
229
231
 
230
- def cookbook_artifact(name, identifier, data, &block)
232
+ def cookbook_artifact(name, identifier, data = {}, &block)
231
233
  with_object_path("cookbook_artifacts/#{name}") do
232
- ChefZero::RSpec.server.load_data({ 'cookbook_artifact' => { name => { identifier => data } } }, current_org)
234
+ # If you didn't specify metadata.rb, we generate it for you. If you
235
+ # explicitly set it to nil, that means you don't want it at all.
236
+ if data.has_key?('metadata.rb')
237
+ if data['metadata.rb'].nil?
238
+ data.delete('metadata.rb')
239
+ end
240
+ else
241
+ data['metadata.rb'] = "name #{name.inspect}"
242
+ end
243
+ ChefZero::RSpec.server.load_data({ 'cookbook_artifacts' => { "#{name}-#{identifier}" => data } }, current_org)
233
244
  instance_eval(&block) if block_given?
234
245
  end
235
246
  end
@@ -473,20 +473,25 @@ module ChefZero
473
473
  end
474
474
  end
475
475
 
476
- if contents['cookbooks']
477
- contents['cookbooks'].each_pair do |name_version, cookbook|
478
- if name_version =~ /(.+)-(\d+\.\d+\.\d+)$/
479
- cookbook_data = ChefData::CookbookData.to_hash(cookbook, $1, $2)
480
- else
481
- cookbook_data = ChefData::CookbookData.to_hash(cookbook, name_version)
482
- end
483
- raise "No version specified" if !cookbook_data[:version]
484
- data_store.create_dir(['organizations', org_name, 'cookbooks'], cookbook_data[:cookbook_name], :recursive)
485
- data_store.set(['organizations', org_name, 'cookbooks', cookbook_data[:cookbook_name], cookbook_data[:version]], FFI_Yajl::Encoder.encode(cookbook_data, :pretty => true), :create)
486
- cookbook_data.values.each do |files|
487
- next unless files.is_a? Array
488
- files.each do |file|
489
- data_store.set(['organizations', org_name, 'file_store', 'checksums', file[:checksum]], get_file(cookbook, file[:path]), :create)
476
+ %w(cookbooks cookbook_artifacts).each do |cookbook_type|
477
+ if contents[cookbook_type]
478
+ contents[cookbook_type].each_pair do |name_version, cookbook|
479
+ if cookbook_type == 'cookbook_artifacts'
480
+ name, dash, identifier = name_version.rpartition('-')
481
+ cookbook_data = ChefData::CookbookData.to_hash(cookbook, name, identifier)
482
+ elsif name_version =~ /(.+)-(\d+\.\d+\.\d+)$/
483
+ cookbook_data = ChefData::CookbookData.to_hash(cookbook, $1, $2)
484
+ else
485
+ cookbook_data = ChefData::CookbookData.to_hash(cookbook, name_version)
486
+ end
487
+ raise "No version specified" if !cookbook_data[:version]
488
+ data_store.create_dir(['organizations', org_name, cookbook_type], cookbook_data[:cookbook_name], :recursive)
489
+ data_store.set(['organizations', org_name, cookbook_type, cookbook_data[:cookbook_name], cookbook_data[:version]], FFI_Yajl::Encoder.encode(cookbook_data, :pretty => true), :create)
490
+ cookbook_data.values.each do |files|
491
+ next unless files.is_a? Array
492
+ files.each do |file|
493
+ data_store.set(['organizations', org_name, 'file_store', 'checksums', file[:checksum]], get_file(cookbook, file[:path]), :create)
494
+ end
490
495
  end
491
496
  end
492
497
  end
@@ -1,3 +1,3 @@
1
1
  module ChefZero
2
- VERSION = '4.4.0'
2
+ VERSION = '4.4.1'
3
3
  end
@@ -108,7 +108,10 @@ begin
108
108
 
109
109
  # Chef 12 features not yet 100% supported by Chef Zero
110
110
  '--skip-containers',
111
- '--skip-api-v1'
111
+ '--skip-api-v1',
112
+
113
+ # The universe endpoint is unlikely to ever make sense for Chef Zero
114
+ '--skip-universe'
112
115
  ] + chef_fs_skips)
113
116
 
114
117
  fail_fast = []
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.0
4
+ version: 4.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-14 00:00:00.000000000 Z
11
+ date: 2016-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-log
@@ -309,7 +309,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
309
309
  version: '0'
310
310
  requirements: []
311
311
  rubyforge_project:
312
- rubygems_version: 2.2.3
312
+ rubygems_version: 2.5.0
313
313
  signing_key:
314
314
  specification_version: 4
315
315
  summary: Self-contained, easy-setup, fast-start in-memory Chef server for testing