chef-zero 14.0.11 → 15.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -6
- data/Rakefile +9 -1
- data/bin/chef-zero +3 -2
- data/chef-zero.gemspec +5 -8
- data/lib/chef_zero.rb +1 -1
- data/lib/chef_zero/chef_data/cookbook_data.rb +1 -1
- data/lib/chef_zero/chef_data/data_normalizer.rb +9 -7
- data/lib/chef_zero/chef_data/default_creator.rb +22 -19
- data/lib/chef_zero/data_store/data_already_exists_error.rb +1 -1
- data/lib/chef_zero/data_store/data_error.rb +1 -1
- data/lib/chef_zero/data_store/data_not_found_error.rb +1 -1
- data/lib/chef_zero/data_store/default_facade.rb +4 -4
- data/lib/chef_zero/data_store/interface_v2.rb +1 -1
- data/lib/chef_zero/data_store/memory_store.rb +3 -3
- data/lib/chef_zero/data_store/memory_store_v2.rb +22 -14
- data/lib/chef_zero/data_store/raw_file_store.rb +7 -5
- data/lib/chef_zero/data_store/v1_to_v2_adapter.rb +11 -1
- data/lib/chef_zero/data_store/v2_to_v1_adapter.rb +1 -1
- data/lib/chef_zero/dist.rb +9 -0
- data/lib/chef_zero/endpoints/acl_endpoint.rb +4 -3
- data/lib/chef_zero/endpoints/acls_endpoint.rb +6 -5
- data/lib/chef_zero/endpoints/actor_default_key_endpoint.rb +2 -1
- data/lib/chef_zero/endpoints/actor_endpoint.rb +4 -4
- data/lib/chef_zero/endpoints/actor_key_endpoint.rb +1 -1
- data/lib/chef_zero/endpoints/actor_keys_endpoint.rb +3 -2
- data/lib/chef_zero/endpoints/actors_endpoint.rb +2 -2
- data/lib/chef_zero/endpoints/authenticate_user_endpoint.rb +3 -2
- data/lib/chef_zero/endpoints/container_endpoint.rb +3 -3
- data/lib/chef_zero/endpoints/containers_endpoint.rb +3 -3
- data/lib/chef_zero/endpoints/controls_endpoint.rb +3 -2
- data/lib/chef_zero/endpoints/cookbook_artifact_endpoint.rb +1 -1
- data/lib/chef_zero/endpoints/cookbook_artifact_identifier_endpoint.rb +3 -3
- data/lib/chef_zero/endpoints/cookbook_artifacts_endpoint.rb +7 -7
- data/lib/chef_zero/endpoints/cookbook_endpoint.rb +1 -1
- data/lib/chef_zero/endpoints/cookbook_version_endpoint.rb +8 -6
- data/lib/chef_zero/endpoints/cookbooks_base.rb +6 -4
- data/lib/chef_zero/endpoints/cookbooks_endpoint.rb +1 -1
- data/lib/chef_zero/endpoints/data_bag_endpoint.rb +4 -4
- data/lib/chef_zero/endpoints/data_bag_item_endpoint.rb +4 -4
- data/lib/chef_zero/endpoints/data_bags_endpoint.rb +3 -3
- data/lib/chef_zero/endpoints/environment_cookbook_endpoint.rb +2 -2
- data/lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb +14 -11
- data/lib/chef_zero/endpoints/environment_cookbooks_endpoint.rb +2 -2
- data/lib/chef_zero/endpoints/environment_endpoint.rb +3 -3
- data/lib/chef_zero/endpoints/environment_nodes_endpoint.rb +2 -2
- data/lib/chef_zero/endpoints/environment_recipes_endpoint.rb +2 -2
- data/lib/chef_zero/endpoints/environment_role_endpoint.rb +2 -2
- data/lib/chef_zero/endpoints/file_store_file_endpoint.rb +1 -1
- data/lib/chef_zero/endpoints/group_endpoint.rb +3 -3
- data/lib/chef_zero/endpoints/groups_endpoint.rb +2 -2
- data/lib/chef_zero/endpoints/license_endpoint.rb +2 -2
- data/lib/chef_zero/endpoints/node_endpoint.rb +3 -3
- data/lib/chef_zero/endpoints/node_identifiers_endpoint.rb +2 -2
- data/lib/chef_zero/endpoints/nodes_endpoint.rb +3 -3
- data/lib/chef_zero/endpoints/not_found_endpoint.rb +2 -2
- data/lib/chef_zero/endpoints/organization_association_request_endpoint.rb +3 -2
- data/lib/chef_zero/endpoints/organization_association_requests_endpoint.rb +2 -2
- data/lib/chef_zero/endpoints/organization_authenticate_user_endpoint.rb +2 -2
- data/lib/chef_zero/endpoints/organization_endpoint.rb +4 -3
- data/lib/chef_zero/endpoints/organization_user_base.rb +2 -2
- data/lib/chef_zero/endpoints/organization_user_default_key_endpoint.rb +1 -1
- data/lib/chef_zero/endpoints/organization_user_endpoint.rb +2 -2
- data/lib/chef_zero/endpoints/organization_user_key_endpoint.rb +2 -2
- data/lib/chef_zero/endpoints/organization_user_keys_endpoint.rb +1 -1
- data/lib/chef_zero/endpoints/organization_users_endpoint.rb +3 -3
- data/lib/chef_zero/endpoints/organization_validator_key_endpoint.rb +2 -2
- data/lib/chef_zero/endpoints/organizations_endpoint.rb +2 -2
- data/lib/chef_zero/endpoints/policies_endpoint.rb +1 -1
- data/lib/chef_zero/endpoints/policy_endpoint.rb +1 -1
- data/lib/chef_zero/endpoints/policy_group_endpoint.rb +3 -3
- data/lib/chef_zero/endpoints/policy_group_policy_endpoint.rb +4 -4
- data/lib/chef_zero/endpoints/policy_groups_endpoint.rb +3 -3
- data/lib/chef_zero/endpoints/policy_revision_endpoint.rb +1 -1
- data/lib/chef_zero/endpoints/policy_revisions_endpoint.rb +1 -1
- data/lib/chef_zero/endpoints/principal_endpoint.rb +3 -3
- data/lib/chef_zero/endpoints/rest_list_endpoint.rb +3 -3
- data/lib/chef_zero/endpoints/rest_object_endpoint.rb +4 -3
- data/lib/chef_zero/endpoints/role_endpoint.rb +3 -3
- data/lib/chef_zero/endpoints/role_environments_endpoint.rb +2 -2
- data/lib/chef_zero/endpoints/sandbox_endpoint.rb +4 -4
- data/lib/chef_zero/endpoints/sandboxes_endpoint.rb +2 -2
- data/lib/chef_zero/endpoints/search_endpoint.rb +9 -9
- data/lib/chef_zero/endpoints/searches_endpoint.rb +1 -1
- data/lib/chef_zero/endpoints/server_api_version_endpoint.rb +1 -1
- data/lib/chef_zero/endpoints/system_recovery_endpoint.rb +4 -4
- data/lib/chef_zero/endpoints/universe_endpoint.rb +3 -3
- data/lib/chef_zero/endpoints/user_association_request_endpoint.rb +3 -2
- data/lib/chef_zero/endpoints/user_association_requests_count_endpoint.rb +2 -2
- data/lib/chef_zero/endpoints/user_association_requests_endpoint.rb +2 -2
- data/lib/chef_zero/endpoints/user_organizations_endpoint.rb +2 -2
- data/lib/chef_zero/endpoints/version_endpoint.rb +3 -2
- data/lib/chef_zero/rest_base.rb +20 -16
- data/lib/chef_zero/rest_request.rb +10 -6
- data/lib/chef_zero/rest_router.rb +3 -3
- data/lib/chef_zero/rspec.rb +6 -5
- data/lib/chef_zero/server.rb +98 -93
- data/lib/chef_zero/socketless_server_map.rb +4 -2
- data/lib/chef_zero/solr/query/phrase.rb +2 -2
- data/lib/chef_zero/solr/query/range_query.rb +3 -3
- data/lib/chef_zero/solr/query/term.rb +1 -1
- data/lib/chef_zero/solr/solr_parser.rb +12 -10
- data/lib/chef_zero/version.rb +1 -1
- data/spec/run_oc_pedant.rb +5 -3
- data/spec/search_spec.rb +2 -2
- data/spec/socketless_server_map_spec.rb +1 -1
- data/spec/support/oc_pedant.rb +1 -1
- metadata +17 -39
@@ -16,10 +16,10 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
require "fileutils"
|
19
|
+
require_relative "data_already_exists_error"
|
20
|
+
require_relative "data_not_found_error"
|
21
|
+
require_relative "interface_v2"
|
22
|
+
require "fileutils" unless defined?(FileUtils)
|
23
23
|
|
24
24
|
module ChefZero
|
25
25
|
module DataStore
|
@@ -44,6 +44,7 @@ module ChefZero
|
|
44
44
|
if destructible
|
45
45
|
Dir.entries(root).each do |entry|
|
46
46
|
next if entry == "." || entry == ".."
|
47
|
+
|
47
48
|
FileUtils.rm_rf(Path.join(root, entry))
|
48
49
|
end
|
49
50
|
end
|
@@ -110,9 +111,10 @@ module ChefZero
|
|
110
111
|
|
111
112
|
def delete_dir(path, *options)
|
112
113
|
if options.include?(:recursive)
|
113
|
-
|
114
|
+
unless File.exist?(path_to(path))
|
114
115
|
raise DataNotFoundError.new(path)
|
115
116
|
end
|
117
|
+
|
116
118
|
FileUtils.rm_rf(path_to(path))
|
117
119
|
else
|
118
120
|
begin
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require_relative "interface_v2"
|
2
2
|
|
3
3
|
module ChefZero
|
4
4
|
module DataStore
|
@@ -21,6 +21,7 @@ module ChefZero
|
|
21
21
|
raise DataNotFoundError.new(path) if skip_organizations?(path)
|
22
22
|
raise "Cannot create #{name} at #{path} with V1ToV2Adapter: only handles a single org named #{single_org}." if skip_organizations?(path, name)
|
23
23
|
raise DataAlreadyExistsError.new(path + [ name ]) if path.size < 2
|
24
|
+
|
24
25
|
fix_exceptions do
|
25
26
|
real_store.create_dir(path[2..-1], name, *options)
|
26
27
|
end
|
@@ -30,6 +31,7 @@ module ChefZero
|
|
30
31
|
raise DataNotFoundError.new(path) if skip_organizations?(path)
|
31
32
|
raise "Cannot create #{name} at #{path} with V1ToV2Adapter: only handles a single org named #{single_org}." if skip_organizations?(path, name)
|
32
33
|
raise DataAlreadyExistsError.new(path + [ name ]) if path.size < 2
|
34
|
+
|
33
35
|
fix_exceptions do
|
34
36
|
real_store.create(path[2..-1], name, data, *options)
|
35
37
|
end
|
@@ -37,6 +39,7 @@ module ChefZero
|
|
37
39
|
|
38
40
|
def get(path, request = nil)
|
39
41
|
raise DataNotFoundError.new(path) if skip_organizations?(path)
|
42
|
+
|
40
43
|
fix_exceptions do
|
41
44
|
# Make it so build_uri will include /organizations/ORG inside the V1 data store
|
42
45
|
if request && request.rest_base_prefix.size == 0
|
@@ -53,6 +56,7 @@ module ChefZero
|
|
53
56
|
|
54
57
|
def set(path, data, *options)
|
55
58
|
raise DataNotFoundError.new(path) if skip_organizations?(path)
|
59
|
+
|
56
60
|
fix_exceptions do
|
57
61
|
real_store.set(path[2..-1], data, *options)
|
58
62
|
end
|
@@ -60,6 +64,7 @@ module ChefZero
|
|
60
64
|
|
61
65
|
def delete(path, *options)
|
62
66
|
raise DataNotFoundError.new(path) if skip_organizations?(path) && !options.include?(:recursive)
|
67
|
+
|
63
68
|
fix_exceptions do
|
64
69
|
real_store.delete(path[2..-1])
|
65
70
|
end
|
@@ -67,6 +72,7 @@ module ChefZero
|
|
67
72
|
|
68
73
|
def delete_dir(path, *options)
|
69
74
|
raise DataNotFoundError.new(path) if skip_organizations?(path) && !options.include?(:recursive)
|
75
|
+
|
70
76
|
fix_exceptions do
|
71
77
|
real_store.delete_dir(path[2..-1], *options)
|
72
78
|
end
|
@@ -74,6 +80,7 @@ module ChefZero
|
|
74
80
|
|
75
81
|
def list(path)
|
76
82
|
raise DataNotFoundError.new(path) if skip_organizations?(path)
|
83
|
+
|
77
84
|
if path == []
|
78
85
|
[ "organizations" ]
|
79
86
|
elsif path == [ "organizations" ]
|
@@ -87,6 +94,7 @@ module ChefZero
|
|
87
94
|
|
88
95
|
def exists?(path)
|
89
96
|
return false if skip_organizations?(path)
|
97
|
+
|
90
98
|
fix_exceptions do
|
91
99
|
real_store.exists?(path[2..-1])
|
92
100
|
end
|
@@ -94,12 +102,14 @@ module ChefZero
|
|
94
102
|
|
95
103
|
def exists_dir?(path)
|
96
104
|
return false if skip_organizations?(path)
|
105
|
+
|
97
106
|
if path == []
|
98
107
|
true
|
99
108
|
elsif path == [ "organizations" ] || path == [ "users" ]
|
100
109
|
true
|
101
110
|
else
|
102
111
|
return false if skip_organizations?(path)
|
112
|
+
|
103
113
|
fix_exceptions do
|
104
114
|
real_store.exists_dir?(path[2..-1])
|
105
115
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require "ffi_yajl"
|
2
|
-
|
3
|
-
|
1
|
+
require "ffi_yajl" unless defined?(FFI_Yajl)
|
2
|
+
require_relative "../rest_base"
|
3
|
+
require_relative "../chef_data/acl_path"
|
4
4
|
|
5
5
|
module ChefZero
|
6
6
|
module Endpoints
|
@@ -23,6 +23,7 @@ module ChefZero
|
|
23
23
|
if !acl_path || !%w{read create update delete grant}.include?(perm)
|
24
24
|
raise RestErrorResponse.new(404, "Object not found: #{build_uri(request.base_uri, request.rest_path)}")
|
25
25
|
end
|
26
|
+
|
26
27
|
[acl_path, perm]
|
27
28
|
end
|
28
29
|
|
@@ -1,7 +1,7 @@
|
|
1
|
-
require "ffi_yajl"
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
require "ffi_yajl" unless defined?(FFI_Yajl)
|
2
|
+
require_relative "../rest_base"
|
3
|
+
require_relative "../chef_data/data_normalizer"
|
4
|
+
require_relative "../chef_data/acl_path"
|
5
5
|
|
6
6
|
module ChefZero
|
7
7
|
module Endpoints
|
@@ -17,9 +17,10 @@ module ChefZero
|
|
17
17
|
path = request.rest_path[0..-2] # Strip off _acl
|
18
18
|
path = path[0..1] if path.size == 3 && path[0] == "organizations" && %w{organization organizations}.include?(path[2])
|
19
19
|
acl_path = ChefData::AclPath.get_acl_data_path(path)
|
20
|
-
|
20
|
+
unless acl_path
|
21
21
|
raise RestErrorResponse.new(404, "Object not found: #{build_uri(request.base_uri, request.rest_path)}")
|
22
22
|
end
|
23
|
+
|
23
24
|
acls = FFI_Yajl::Parser.parse(get_data(request, acl_path))
|
24
25
|
acls = ChefData::DataNormalizer.normalize_acls(acls)
|
25
26
|
if request.query_params["detail"] == "granular"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require_relative "../rest_base"
|
2
2
|
|
3
3
|
module ChefZero
|
4
4
|
module Endpoints
|
@@ -53,6 +53,7 @@ module ChefZero
|
|
53
53
|
|
54
54
|
def actor_path(request)
|
55
55
|
return request.rest_path[0..3] if request.rest_path[2] == "clients"
|
56
|
+
|
56
57
|
request.rest_path[0..1]
|
57
58
|
end
|
58
59
|
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require "ffi_yajl"
|
2
|
-
|
3
|
-
|
1
|
+
require "ffi_yajl" unless defined?(FFI_Yajl)
|
2
|
+
require_relative "rest_object_endpoint"
|
3
|
+
require_relative "../chef_data/data_normalizer"
|
4
4
|
|
5
5
|
module ChefZero
|
6
6
|
module Endpoints
|
@@ -125,7 +125,7 @@ module ChefZero
|
|
125
125
|
def rename_keys!(request, new_client_or_user_name)
|
126
126
|
orig_keys_path = keys_path_base(request)
|
127
127
|
new_keys_path = orig_keys_path.dup
|
128
|
-
|
128
|
+
.tap { |path| path[-2] = new_client_or_user_name }
|
129
129
|
|
130
130
|
key_names = list_data_or_else(request, orig_keys_path, nil)
|
131
131
|
return unless key_names # No keys to move
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require_relative "../rest_base"
|
2
2
|
|
3
3
|
module ChefZero
|
4
4
|
module Endpoints
|
@@ -50,7 +50,7 @@ module ChefZero
|
|
50
50
|
response_body["private_key"] = private_key if generate_keys
|
51
51
|
|
52
52
|
json_response(201, response_body,
|
53
|
-
|
53
|
+
headers: { "Location" => response_body["uri"] })
|
54
54
|
end
|
55
55
|
|
56
56
|
private
|
@@ -117,6 +117,7 @@ module ChefZero
|
|
117
117
|
|
118
118
|
def actor_path(request)
|
119
119
|
return request.rest_path[0..3] if client?(request)
|
120
|
+
|
120
121
|
request.rest_path[0..1]
|
121
122
|
end
|
122
123
|
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require "ffi_yajl"
|
2
|
-
|
1
|
+
require "ffi_yajl" unless defined?(FFI_Yajl)
|
2
|
+
require_relative "../rest_base"
|
3
3
|
|
4
4
|
module ChefZero
|
5
5
|
module Endpoints
|
@@ -19,6 +19,7 @@ module ChefZero
|
|
19
19
|
if user["password"] != password
|
20
20
|
raise RestErrorResponse.new(401, "Bad username or password")
|
21
21
|
end
|
22
|
+
|
22
23
|
# Include only particular user data in the response
|
23
24
|
user.keep_if { |key, value| %w{first_name last_name display_name email username}.include?(key) }
|
24
25
|
json_response(200, {
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require "ffi_yajl"
|
2
|
-
|
3
|
-
|
1
|
+
require "ffi_yajl" unless defined?(FFI_Yajl)
|
2
|
+
require_relative "rest_object_endpoint"
|
3
|
+
require_relative "../chef_data/data_normalizer"
|
4
4
|
|
5
5
|
module ChefZero
|
6
6
|
module Endpoints
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require "ffi_yajl"
|
2
|
-
|
1
|
+
require "ffi_yajl" unless defined?(FFI_Yajl)
|
2
|
+
require_relative "rest_list_endpoint"
|
3
3
|
|
4
4
|
module ChefZero
|
5
5
|
module Endpoints
|
@@ -15,7 +15,7 @@ module ChefZero
|
|
15
15
|
data = parse_json(request.body)
|
16
16
|
# if they don't match, id wins.
|
17
17
|
container_name = data["id"] || data["containername"]
|
18
|
-
container_path_suffix = data["containerpath"].split("/").reject
|
18
|
+
container_path_suffix = data["containerpath"].split("/").reject(&:empty?)
|
19
19
|
create_data(request, request.rest_path, container_name, to_json({}), :create_dir)
|
20
20
|
|
21
21
|
json_response(201, { uri: build_uri(request.base_uri, request.rest_path + container_path_suffix + [container_name]) })
|
@@ -1,14 +1,15 @@
|
|
1
|
+
require_relative "../dist"
|
1
2
|
module ChefZero
|
2
3
|
module Endpoints
|
3
4
|
# /organizations/ORG/controls
|
4
5
|
class ControlsEndpoint < RestBase
|
5
6
|
# ours is not to wonder why; ours is but to make the pedant specs pass.
|
6
7
|
def get(request)
|
7
|
-
error(410, "Server says 410,
|
8
|
+
error(410, "Server says 410, #{ChefZero::Dist::CLIENT} says 410.")
|
8
9
|
end
|
9
10
|
|
10
11
|
def post(request)
|
11
|
-
error(410, "Server says 410,
|
12
|
+
error(410, "Server says 410, #{ChefZero::Dist::CLIENT} says 410.")
|
12
13
|
end
|
13
14
|
end
|
14
15
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require_relative "../chef_data/data_normalizer"
|
2
2
|
|
3
3
|
module ChefZero
|
4
4
|
module Endpoints
|
@@ -60,8 +60,8 @@ module ChefZero
|
|
60
60
|
def normalize(request, cookbook_artifact_data)
|
61
61
|
cookbook = parse_json(cookbook_artifact_data)
|
62
62
|
ChefData::DataNormalizer.normalize_cookbook(self, request.rest_path[0..1],
|
63
|
-
|
64
|
-
|
63
|
+
cookbook, request.rest_path[3], request.rest_path[4],
|
64
|
+
request.base_uri, request.method, true, api_version: request.api_version)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require_relative "../chef_data/data_normalizer"
|
2
2
|
|
3
3
|
module ChefZero
|
4
4
|
module Endpoints
|
@@ -8,12 +8,12 @@ module ChefZero
|
|
8
8
|
data = {}
|
9
9
|
|
10
10
|
artifacts = begin
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
list_data(request)
|
12
|
+
rescue Exception => e
|
13
|
+
if e.response_code == 404
|
14
|
+
return already_json_response(200, "{}")
|
15
|
+
end
|
16
|
+
end
|
17
17
|
|
18
18
|
artifacts.each do |cookbook_artifact|
|
19
19
|
cookbook_url = build_uri(request.base_uri, request.rest_path + [cookbook_artifact])
|
@@ -1,8 +1,8 @@
|
|
1
|
-
require "ffi_yajl"
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
require "ffi_yajl" unless defined?(FFI_Yajl)
|
2
|
+
require_relative "rest_object_endpoint"
|
3
|
+
require_relative "../rest_error_response"
|
4
|
+
require_relative "../chef_data/data_normalizer"
|
5
|
+
require_relative "../data_store/data_not_found_error"
|
6
6
|
|
7
7
|
module ChefZero
|
8
8
|
module Endpoints
|
@@ -27,9 +27,10 @@ module ChefZero
|
|
27
27
|
if request.query_params["force"] != "true"
|
28
28
|
raise RestErrorResponse.new(409, "The cookbook #{name} at version #{version} is frozen. Use the 'force' option to override.")
|
29
29
|
end
|
30
|
+
|
30
31
|
# For some reason, you are forever unable to modify "frozen?" on a frozen cookbook.
|
31
32
|
request_body = FFI_Yajl::Parser.parse(request.body)
|
32
|
-
|
33
|
+
unless request_body["frozen?"]
|
33
34
|
request_body["frozen?"] = true
|
34
35
|
request.body = FFI_Yajl::Encoder.encode(request_body, pretty: true)
|
35
36
|
end
|
@@ -92,6 +93,7 @@ module ChefZero
|
|
92
93
|
rescue ChefZero::DataStore::DataNotFoundError
|
93
94
|
# Not all chef versions support cookbook_artifacts
|
94
95
|
raise unless cookbook_type == "cookbook_artifacts"
|
96
|
+
|
95
97
|
cookbooks = []
|
96
98
|
end
|
97
99
|
cookbooks.each do |cookbook_name|
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require "ffi_yajl"
|
2
|
-
|
3
|
-
|
1
|
+
require "ffi_yajl" unless defined?(FFI_Yajl)
|
2
|
+
require_relative "../rest_base"
|
3
|
+
require_relative "../chef_data/data_normalizer"
|
4
4
|
|
5
5
|
module ChefZero
|
6
6
|
module Endpoints
|
@@ -52,8 +52,9 @@ module ChefZero
|
|
52
52
|
cookbooks_list.keys.sort.each do |name|
|
53
53
|
constraint = Gem::Requirement.new(constraints[name])
|
54
54
|
versions = []
|
55
|
-
cookbooks_list[name].sort_by { |version| Gem::Version.new(version.dup) }.
|
55
|
+
cookbooks_list[name].sort_by { |version| Gem::Version.new(version.dup) }.reverse_each do |version|
|
56
56
|
break if num_versions && versions.size >= num_versions
|
57
|
+
|
57
58
|
if constraint.satisfied_by?(Gem::Version.new(version.dup))
|
58
59
|
versions << version
|
59
60
|
end
|
@@ -66,6 +67,7 @@ module ChefZero
|
|
66
67
|
cookbook["all_files"].inject([]) do |acc, file|
|
67
68
|
part, name = file["name"].split("/")
|
68
69
|
next acc unless part == "recipes" || File.extname(name) != ".rb"
|
70
|
+
|
69
71
|
if name == "default.rb"
|
70
72
|
acc << cookbook_name
|
71
73
|
else
|
@@ -1,7 +1,7 @@
|
|
1
|
-
require "ffi_yajl"
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
require "ffi_yajl" unless defined?(FFI_Yajl)
|
2
|
+
require_relative "rest_list_endpoint"
|
3
|
+
require_relative "data_bag_item_endpoint"
|
4
|
+
require_relative "../rest_error_response"
|
5
5
|
|
6
6
|
module ChefZero
|
7
7
|
module Endpoints
|