chef-zero 4.4.1 → 4.4.2

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: 6d28e6a6bda690839d80bd54dce06e9e4bf320fe
4
- data.tar.gz: 1858dce1cfdb1a48af5104b29352937ac9fb6138
3
+ metadata.gz: b00b9dd1a0418e42c1982b8724f0f37f636d8370
4
+ data.tar.gz: eae57d6dae04d8e748f2d4d11f880c50263d3cf3
5
5
  SHA512:
6
- metadata.gz: 47705c89adc13d890d9d2454ad3fb4c0d1d451f57a91a593d4c5a31c29b94f06026abc93dbf8a1e73f2931c592833f80e853d6e86cb8a3c22f6e0da13ed1b13c
7
- data.tar.gz: 6ae3097039e28c17ceded5a7811b8179c33392c22650450936225e6c81c2af343aceafa75c662862f9565b9f9718d87bf126ac8e4b50124b4de96e761c040338
6
+ metadata.gz: 3ceb0e894eb2bf6a7d72eed6817d6fe472f7540d8eb78d677f9b0df327ce219a4d3d996017bcf19c5129fc477bf2a18f96ef24e2248bbbbc4c6343ee910cc1af
7
+ data.tar.gz: be1e03b074776f923a76a81dfdc031f87de2491488e8fbc6f01a47d4e8dcf22c619b6ec2ae07b9630f9a9c88564fa9227cbdd0b526fb0f07523f92f427bd4523
@@ -2,7 +2,7 @@ require 'chef_zero/chef_data/data_normalizer'
2
2
 
3
3
  module ChefZero
4
4
  module Endpoints
5
- class CookbookArtifactsCookbookEndpoint < RestBase
5
+ class CookbookArtifactEndpoint < RestBase
6
6
  # GET /organizations/ORG/cookbook_artifacts/COOKBOOK
7
7
  def get(request)
8
8
  cookbook_name = request.rest_path.last
@@ -2,7 +2,7 @@ require 'chef_zero/chef_data/data_normalizer'
2
2
 
3
3
  module ChefZero
4
4
  module Endpoints
5
- class CookbookArtifactsCookbookIdentifierEndpoint < ChefZero::Endpoints::CookbookVersionEndpoint
5
+ class CookbookArtifactIdentifierEndpoint < ChefZero::Endpoints::CookbookVersionEndpoint
6
6
  # these endpoints are almost, but not quite, not entirely unlike the corresponding /cookbooks endpoints.
7
7
  # it could all be refactored for maximum reuse, but they're short REST methods with well-defined
8
8
  # behavioral specs (pedant), so there's not a huge benefit.
@@ -32,13 +32,14 @@ module ChefZero
32
32
  delete_data(request)
33
33
 
34
34
  # go through the recipes and delete stuff in the file store.
35
- hoover_unused_checksums(get_checksums(doomed_cookbook_json), request, 'cookbook_artifacts')
35
+ hoover_unused_checksums(get_checksums(doomed_cookbook_json), request)
36
36
 
37
37
  # if this was the last revision, delete the directory so future requests will 404, instead of
38
38
  # returning 200 with an empty list.
39
- artifact_path = request.rest_path[0..-2]
40
- if list_data(request, artifact_path).size == 0
41
- delete_data_dir(request, artifact_path)
39
+ # Last one out turns out the lights: delete /organizations/ORG/cookbooks/COOKBOOK if it no longer has versions
40
+ cookbook_path = request.rest_path[0..3]
41
+ if exists_data_dir?(request, cookbook_path) && list_data(request, cookbook_path).size == 0
42
+ delete_data_dir(request, cookbook_path)
42
43
  end
43
44
 
44
45
  json_response(200, identified_cookbook_data)
@@ -58,8 +58,8 @@ module ChefZero
58
58
  deleted_cookbook = get_data(request)
59
59
 
60
60
  response = super(request)
61
- cookbook_name = request.rest_path[3]
62
- cookbook_path = request.rest_path[0..1] + ['cookbooks', cookbook_name]
61
+ # Last one out turns out the lights: delete /organizations/ORG/cookbooks/NAME if it no longer has versions
62
+ cookbook_path = request.rest_path[0..3]
63
63
  if exists_data_dir?(request, cookbook_path) && list_data(request, cookbook_path).size == 0
64
64
  delete_data_dir(request, cookbook_path)
65
65
  end
@@ -85,11 +85,20 @@ module ChefZero
85
85
 
86
86
  private
87
87
 
88
- def hoover_unused_checksums(deleted_checksums, request, data_type='cookbooks')
89
- data_store.list(request.rest_path[0..1] + [data_type]).each do |cookbook_name|
90
- data_store.list(request.rest_path[0..1] + [data_type, cookbook_name]).each do |version|
91
- cookbook = data_store.get(request.rest_path[0..1] + [data_type, cookbook_name, version], request)
92
- deleted_checksums = deleted_checksums - get_checksums(cookbook)
88
+ def hoover_unused_checksums(deleted_checksums, request)
89
+ %w(cookbooks cookbook_artifacts).each do |cookbook_type|
90
+ begin
91
+ cookbooks = data_store.list(request.rest_path[0..1] + [cookbook_type])
92
+ rescue ChefZero::DataStore::DataNotFoundError
93
+ # Not all chef versions support cookbook_artifacts
94
+ raise unless cookbook_type == "cookbook_artifacts"
95
+ cookbooks = []
96
+ end
97
+ cookbooks.each do |cookbook_name|
98
+ data_store.list(request.rest_path[0..1] + [cookbook_type, cookbook_name]).each do |version|
99
+ cookbook = data_store.get(request.rest_path[0..1] + [cookbook_type, cookbook_name, version], request)
100
+ deleted_checksums = deleted_checksums - get_checksums(cookbook)
101
+ end
93
102
  end
94
103
  end
95
104
  deleted_checksums.each do |checksum|
@@ -45,9 +45,9 @@ require 'chef_zero/endpoints/actor_endpoint'
45
45
  require 'chef_zero/endpoints/cookbooks_endpoint'
46
46
  require 'chef_zero/endpoints/cookbook_endpoint'
47
47
  require 'chef_zero/endpoints/cookbook_version_endpoint'
48
- require 'chef_zero/endpoints/cookbook_artifacts_cookbook_endpoint'
49
- require 'chef_zero/endpoints/cookbook_artifacts_cookbook_identifier'
50
48
  require 'chef_zero/endpoints/cookbook_artifacts_endpoint'
49
+ require 'chef_zero/endpoints/cookbook_artifact_endpoint'
50
+ require 'chef_zero/endpoints/cookbook_artifact_identifier_endpoint'
51
51
  require 'chef_zero/endpoints/containers_endpoint'
52
52
  require 'chef_zero/endpoints/container_endpoint'
53
53
  require 'chef_zero/endpoints/dummy_endpoint'
@@ -567,8 +567,8 @@ module ChefZero
567
567
  [ "/organizations/*/cookbooks/*", CookbookEndpoint.new(self) ],
568
568
  [ "/organizations/*/cookbooks/*/*", CookbookVersionEndpoint.new(self) ],
569
569
  [ "/organizations/*/cookbook_artifacts", CookbookArtifactsEndpoint.new(self) ],
570
- [ "/organizations/*/cookbook_artifacts/*", CookbookArtifactsCookbookEndpoint.new(self) ],
571
- [ "/organizations/*/cookbook_artifacts/*/*", CookbookArtifactsCookbookIdentifierEndpoint.new(self) ],
570
+ [ "/organizations/*/cookbook_artifacts/*", CookbookArtifactEndpoint.new(self) ],
571
+ [ "/organizations/*/cookbook_artifacts/*/*", CookbookArtifactIdentifierEndpoint.new(self) ],
572
572
  [ "/organizations/*/data", DataBagsEndpoint.new(self) ],
573
573
  [ "/organizations/*/data/*", DataBagEndpoint.new(self) ],
574
574
  [ "/organizations/*/data/*/*", DataBagItemEndpoint.new(self) ],
@@ -1,3 +1,3 @@
1
1
  module ChefZero
2
- VERSION = '4.4.1'
2
+ VERSION = '4.4.2'
3
3
  end
@@ -98,13 +98,28 @@ begin
98
98
  '--skip-keys',
99
99
  '--skip-controls',
100
100
  '--skip-acl',
101
+ '--skip-headers',
102
+
103
+ # Chef Zero does not intend to support validation the way erchef does.
101
104
  '--skip-validation',
105
+
106
+ # Chef Zero does not intend to support authentication the way erchef does.
102
107
  '--skip-authentication',
108
+
109
+ # Chef Zero does not intend to support authorization the way erchef does.
103
110
  '--skip-authorization',
111
+
112
+ # Omnibus tests depend on erchef features that are specific to erchef and
113
+ # bundled in the omnibus package. Currently the only test in this category
114
+ # is for the search reindexing script.
104
115
  '--skip-omnibus',
116
+
117
+ # USAGs (user-specific association groups) are Authz groups that contain
118
+ # only one user and represent that user's association with an org. Though
119
+ # there are good reasons for them, they don't work well in practice and
120
+ # only the manage console really uses them. Since Chef Zero + Manage is a
121
+ # quite unusual configuration, we're ignoring them.
105
122
  '--skip-usags',
106
- '--exclude-internal-orgs',
107
- '--skip-headers',
108
123
 
109
124
  # Chef 12 features not yet 100% supported by Chef Zero
110
125
  '--skip-containers',
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.1
4
+ version: 4.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-14 00:00:00.000000000 Z
11
+ date: 2016-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-log
@@ -207,8 +207,8 @@ files:
207
207
  - lib/chef_zero/endpoints/authenticate_user_endpoint.rb
208
208
  - lib/chef_zero/endpoints/container_endpoint.rb
209
209
  - lib/chef_zero/endpoints/containers_endpoint.rb
210
- - lib/chef_zero/endpoints/cookbook_artifacts_cookbook_endpoint.rb
211
- - lib/chef_zero/endpoints/cookbook_artifacts_cookbook_identifier.rb
210
+ - lib/chef_zero/endpoints/cookbook_artifact_endpoint.rb
211
+ - lib/chef_zero/endpoints/cookbook_artifact_identifier_endpoint.rb
212
212
  - lib/chef_zero/endpoints/cookbook_artifacts_endpoint.rb
213
213
  - lib/chef_zero/endpoints/cookbook_endpoint.rb
214
214
  - lib/chef_zero/endpoints/cookbook_version_endpoint.rb