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 +4 -4
- data/lib/chef_zero/endpoints/{cookbook_artifacts_cookbook_endpoint.rb → cookbook_artifact_endpoint.rb} +1 -1
- data/lib/chef_zero/endpoints/{cookbook_artifacts_cookbook_identifier.rb → cookbook_artifact_identifier_endpoint.rb} +6 -5
- data/lib/chef_zero/endpoints/cookbook_version_endpoint.rb +16 -7
- data/lib/chef_zero/server.rb +4 -4
- data/lib/chef_zero/version.rb +1 -1
- data/spec/run_oc_pedant.rb +17 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b00b9dd1a0418e42c1982b8724f0f37f636d8370
|
4
|
+
data.tar.gz: eae57d6dae04d8e748f2d4d11f880c50263d3cf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
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
|
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
|
-
|
40
|
-
|
41
|
-
|
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
|
-
|
62
|
-
cookbook_path = request.rest_path[0..
|
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
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
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|
|
data/lib/chef_zero/server.rb
CHANGED
@@ -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/*",
|
571
|
-
[ "/organizations/*/cookbook_artifacts/*/*",
|
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) ],
|
data/lib/chef_zero/version.rb
CHANGED
data/spec/run_oc_pedant.rb
CHANGED
@@ -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.
|
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-
|
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/
|
211
|
-
- lib/chef_zero/endpoints/
|
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
|