chef-zero 15.0.21 → 15.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/chef-zero.gemspec +0 -4
- data/lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb +18 -8
- data/lib/chef_zero/version.rb +1 -1
- metadata +2 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f6cfa8312a0f246206cc805936245e69fd1b0e6f56e60fe575ee54c4e4d10b65
|
|
4
|
+
data.tar.gz: 8dce047df7b695f99fb8cd8a48d3c2facd505d363548e71c3e265b6b5a8d2287
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6f6a40dc53903594f681522401bf0eddbc20af48ff10462e242c4be6934c2f2152841ac91142e67e885d5929ba04baa5d6651d266db77cc77f14229ae0af08d6
|
|
7
|
+
data.tar.gz: 226c915e3b0f1d60a15cec11108dfc4d184d9092194bb9ab3241daaca1092071809e49bd2211576aaa989e3abfebf55e0eaa87781c9c657c318a4e9b2a72d638
|
data/chef-zero.gemspec
CHANGED
|
@@ -13,10 +13,6 @@ Gem::Specification.new do |s|
|
|
|
13
13
|
|
|
14
14
|
s.required_ruby_version = ">= 3.0"
|
|
15
15
|
|
|
16
|
-
# Note: 7.1.0 does not defaults its cache_format_version to 7.1 but 6.1 instead which gives deprecation warnings
|
|
17
|
-
# Remove the version constraint when we can upgrade to 7.1.1 post stable release of Activesupport 7.1
|
|
18
|
-
# Similar issue with 7.0 existed: https://github.com/rails/rails/pull/45293
|
|
19
|
-
s.add_dependency "activesupport", ">= 7", "< 8.1"
|
|
20
16
|
s.add_dependency "mixlib-log", ">= 2.0", "< 4.0"
|
|
21
17
|
s.add_dependency "hashie", ">= 2.0", "< 6.0"
|
|
22
18
|
s.add_dependency "uuidtools", "~> 2.1"
|
|
@@ -36,7 +36,7 @@ module ChefZero
|
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
# Depsolve!
|
|
39
|
-
solved = depsolve(request, desired_versions.keys, desired_versions, environment_constraints)
|
|
39
|
+
solved, cookbook_obj_cache = depsolve(request, desired_versions.keys, desired_versions, environment_constraints)
|
|
40
40
|
unless solved
|
|
41
41
|
if @last_missing_dep && !cookbook_names.include?(@last_missing_dep)
|
|
42
42
|
return raise RestErrorResponse.new(412, "No such cookbook: #{@last_missing_dep}")
|
|
@@ -50,23 +50,31 @@ module ChefZero
|
|
|
50
50
|
|
|
51
51
|
result = {}
|
|
52
52
|
solved.each_pair do |name, versions|
|
|
53
|
-
|
|
53
|
+
if cookbook_obj_cache.dig(name, versions[0])
|
|
54
|
+
cookbook = cookbook_obj_cache[name][versions[0]]
|
|
55
|
+
else
|
|
56
|
+
cookbook = FFI_Yajl::Parser.parse(get_data(request, request.rest_path[0..1] + ["cookbooks", name, versions[0]]))
|
|
57
|
+
end
|
|
54
58
|
result[name] = ChefData::DataNormalizer.normalize_cookbook(self, request.rest_path[0..1], cookbook, name, versions[0], request.base_uri, "MIN", false, api_version: request.api_version)
|
|
55
59
|
end
|
|
56
60
|
json_response(200, result)
|
|
57
61
|
end
|
|
58
62
|
|
|
59
|
-
def depsolve(request, unsolved, desired_versions, environment_constraints)
|
|
63
|
+
def depsolve(request, unsolved, desired_versions, environment_constraints, cookbook_obj_cache = nil)
|
|
60
64
|
desired_versions.each do |cb, ver|
|
|
61
65
|
if ver.empty?
|
|
62
66
|
@last_constraint_failure = cb
|
|
63
|
-
return nil
|
|
67
|
+
return [nil, nil]
|
|
64
68
|
end
|
|
65
69
|
end
|
|
66
70
|
|
|
67
71
|
# If everything is already
|
|
68
72
|
solve_for = unsolved[0]
|
|
69
|
-
return desired_versions unless solve_for
|
|
73
|
+
return [desired_versions, cookbook_obj_cache] unless solve_for
|
|
74
|
+
|
|
75
|
+
# Cache the get_data calls - this saves the need to run the get_data call a second time in #post
|
|
76
|
+
# Conceptually: cache[cookbook][version] = cookbook_object
|
|
77
|
+
cookbook_obj_cache ||= {}
|
|
70
78
|
|
|
71
79
|
# Go through each desired version of this cookbook, starting with the latest,
|
|
72
80
|
# until we find one we can solve successfully with
|
|
@@ -77,6 +85,8 @@ module ChefZero
|
|
|
77
85
|
|
|
78
86
|
# Pick this cookbook, and add dependencies
|
|
79
87
|
cookbook_obj = FFI_Yajl::Parser.parse(get_data(request, request.rest_path[0..1] + ["cookbooks", solve_for, desired_version]))
|
|
88
|
+
cookbook_obj_cache[solve_for] ||= {}
|
|
89
|
+
cookbook_obj_cache[solve_for][desired_version] = cookbook_obj
|
|
80
90
|
cookbook_metadata = cookbook_obj["metadata"] || {}
|
|
81
91
|
cookbook_dependencies = cookbook_metadata["dependencies"] || {}
|
|
82
92
|
dep_not_found = false
|
|
@@ -100,10 +110,10 @@ module ChefZero
|
|
|
100
110
|
next if dep_not_found
|
|
101
111
|
|
|
102
112
|
# Depsolve children with this desired version! First solution wins.
|
|
103
|
-
result = depsolve(request, new_unsolved, new_desired_versions, environment_constraints)
|
|
104
|
-
return result if result
|
|
113
|
+
result, cookbook_obj_cache = depsolve(request, new_unsolved, new_desired_versions, environment_constraints, cookbook_obj_cache)
|
|
114
|
+
return [result, cookbook_obj_cache] if result
|
|
105
115
|
end
|
|
106
|
-
nil
|
|
116
|
+
[nil, nil]
|
|
107
117
|
end
|
|
108
118
|
|
|
109
119
|
def sort_versions(versions)
|
data/lib/chef_zero/version.rb
CHANGED
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: 15.0.
|
|
4
|
+
version: 15.0.26
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chef Software, Inc.
|
|
@@ -9,26 +9,6 @@ bindir: bin
|
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
|
-
- !ruby/object:Gem::Dependency
|
|
13
|
-
name: activesupport
|
|
14
|
-
requirement: !ruby/object:Gem::Requirement
|
|
15
|
-
requirements:
|
|
16
|
-
- - ">="
|
|
17
|
-
- !ruby/object:Gem::Version
|
|
18
|
-
version: '7'
|
|
19
|
-
- - "<"
|
|
20
|
-
- !ruby/object:Gem::Version
|
|
21
|
-
version: '8.1'
|
|
22
|
-
type: :runtime
|
|
23
|
-
prerelease: false
|
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
-
requirements:
|
|
26
|
-
- - ">="
|
|
27
|
-
- !ruby/object:Gem::Version
|
|
28
|
-
version: '7'
|
|
29
|
-
- - "<"
|
|
30
|
-
- !ruby/object:Gem::Version
|
|
31
|
-
version: '8.1'
|
|
32
12
|
- !ruby/object:Gem::Dependency
|
|
33
13
|
name: mixlib-log
|
|
34
14
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -317,7 +297,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
317
297
|
- !ruby/object:Gem::Version
|
|
318
298
|
version: '0'
|
|
319
299
|
requirements: []
|
|
320
|
-
rubygems_version: 3.
|
|
300
|
+
rubygems_version: 3.7.2
|
|
321
301
|
specification_version: 4
|
|
322
302
|
summary: Self-contained, easy-setup, fast-start in-memory Chef server for testing
|
|
323
303
|
and solo setup purposes
|