chef-zero 15.0.21 → 15.1.0
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
- data/spec/run_oc_pedant.rb +2 -18
- 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: 00071a8eebf554379bd831d228ca87964ee665a935232b1055ab0ab9628117d4
|
|
4
|
+
data.tar.gz: 15c1ee1fbe857a55ee344ecd1329b786731bc7526cb0d4b56d6801595e7e3520
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0e35acb20599a35cf00e7475172c6596b898f5e2597a12421a2f01d50d84afd4431157ec6f6d41e6f9854d6a912f1bd94d6ea559d941e3a54d6d39cbab5c2108
|
|
7
|
+
data.tar.gz: cb64bb7aa2be0a339c2508c06355f2b45bcdfdb2d3fef7ffa50d5ad2ed0a85de3381c80039d14fea7a1d5fbc00891c60cc095dfd01ecb64dba4565d2c8c8fe5c
|
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
data/spec/run_oc_pedant.rb
CHANGED
|
@@ -52,13 +52,6 @@ def start_cheffs_server(chef_repo_path)
|
|
|
52
52
|
|
|
53
53
|
Dir.mkdir(chef_repo_path) unless File.exist?(chef_repo_path)
|
|
54
54
|
|
|
55
|
-
# 11.6 and below had a bug where it couldn't create the repo children automatically
|
|
56
|
-
if Chef::VERSION.to_f < 11.8
|
|
57
|
-
%w{clients cookbooks data_bags environments nodes roles users}.each do |child|
|
|
58
|
-
Dir.mkdir("#{chef_repo_path}/#{child}") unless File.exist?("#{chef_repo_path}/#{child}")
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
|
|
62
55
|
# Start the new server
|
|
63
56
|
Chef::Config.repo_mode = "hosted_everything"
|
|
64
57
|
Chef::Config.chef_repo_path = chef_repo_path
|
|
@@ -125,7 +118,8 @@ begin
|
|
|
125
118
|
Pedant.config[:config_file] = "spec/support/oc_pedant.rb"
|
|
126
119
|
|
|
127
120
|
# Because ChefFS can only ever have one user (pivotal), we can't do most of the
|
|
128
|
-
# tests that involve multiple
|
|
121
|
+
# tests that involve multiple users. All modern Chef versions (>= 12.13.19)
|
|
122
|
+
# support keys, ACL, cookbook-artifacts, and policies, so we don't skip those.
|
|
129
123
|
chef_fs_skips = if ENV["CHEF_FS"]
|
|
130
124
|
[ "--skip-association",
|
|
131
125
|
"--skip-users",
|
|
@@ -137,16 +131,6 @@ begin
|
|
|
137
131
|
[]
|
|
138
132
|
end
|
|
139
133
|
|
|
140
|
-
unless Gem::Requirement.new(">= 12.8.0").satisfied_by?(Gem::Version.new(Chef::VERSION))
|
|
141
|
-
chef_fs_skips << "--skip-keys"
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
unless Gem::Requirement.new(">= 12.13.19").satisfied_by?(Gem::Version.new(Chef::VERSION))
|
|
145
|
-
chef_fs_skips << "--skip-acl"
|
|
146
|
-
chef_fs_skips << "--skip-cookbook-artifacts"
|
|
147
|
-
chef_fs_skips << "--skip-policies"
|
|
148
|
-
end
|
|
149
|
-
|
|
150
134
|
# These things aren't supported by Chef Zero in any mode of operation:
|
|
151
135
|
default_skips = [
|
|
152
136
|
# "the goal is that only authorization, authentication and validation tests
|
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.1.0
|
|
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
|