1 --- chef-14.1.21/chef-config/lib/chef-config/config.rb.orig 2018-05-21 18:22:54.000000000 +0200
2 +++ chef-14.1.21/chef-config/lib/chef-config/config.rb 2018-07-14 22:03:35.187220811 +0200
5 # Location of cookbooks on disk. String or array of strings.
6 # Defaults to <chef_repo_path>/cookbooks. If chef_repo_path
7 - # is not specified, this is set to [/var/chef/cookbooks, /var/chef/site-cookbooks]).
8 + # is not specified, this is set to [/var/lib/chef/cookbooks, /var/lib/chef/site-cookbooks]).
9 default(:cookbook_path) do
10 if configuration[:chef_repo_path]
11 derive_path_from_chef_repo_path("cookbooks")
13 PathHelper.join(config_dir, "local-mode-cache")
15 primary_cache_root = platform_specific_path("/var")
16 - primary_cache_path = platform_specific_path("/var/chef")
17 - # Use /var/chef as the cache path only if that folder exists and we can read and write
18 - # into it, or /var exists and we can read and write into it (we'll create /var/chef later).
19 + primary_cache_path = platform_specific_path("/var/cache/chef")
20 + # Use /var/cache/chef as the cache path only if that folder exists and we can read and write
21 + # into it, or /var exists and we can read and write into it (we'll create /var/cache/chef later).
22 # Otherwise, we'll create .chef under the user's home directory and use that as
24 unless path_accessible?(primary_cache_path) || path_accessible?(primary_cache_root)
26 default(:checksum_path) { PathHelper.join(cache_path, "checksums") }
28 # Where chef's cache files should be stored
29 - default(:file_cache_path) { PathHelper.join(cache_path, "cache") }
30 + default(:file_cache_path) { cache_path }
32 # Where backups of chef-managed files should go
33 - default(:file_backup_path) { PathHelper.join(cache_path, "backup") }
34 + default(:file_backup_path) { "/var/lib/chef/backup" }
36 # The chef-client (or solo) lockfile.
38 --- chef-14.1.21/chef-config/spec/unit/config_spec.rb.orig 2018-05-21 18:22:54.000000000 +0200
39 +++ chef-14.1.21/chef-config/spec/unit/config_spec.rb 2018-07-14 22:10:47.642865027 +0200
42 "#{ChefConfig::Config.env['SYSTEMDRIVE']}\\chef"
50 allow(File).to receive(:expand_path).and_return("#{ChefConfig::Config.env["SYSTEMDRIVE"]}/Path/To/Executable")
53 - context "when /var/chef exists and is accessible" do
54 - it "defaults to /var/chef" do
55 - allow(ChefConfig::Config).to receive(:path_accessible?).with(to_platform("/var/chef")).and_return(true)
56 + context "when /var/cache/chef exists and is accessible" do
57 + it "defaults to /var/cache/chef" do
58 + allow(ChefConfig::Config).to receive(:path_accessible?).with(to_platform("/var/cache/chef")).and_return(true)
59 expect(ChefConfig::Config[:cache_path]).to eq(primary_cache_path)
63 - context "when /var/chef does not exist and /var is accessible" do
64 - it "defaults to /var/chef" do
65 - allow(File).to receive(:exists?).with(to_platform("/var/chef")).and_return(false)
66 - allow(ChefConfig::Config).to receive(:path_accessible?).with(to_platform("/var")).and_return(true)
67 + context "when /var/cache/chef does not exist and /var is accessible" do
68 + it "defaults to /var/cache/chef" do
69 + allow(File).to receive(:exists?).with(to_platform("/var/cache/chef")).and_return(false)
70 + allow(ChefConfig::Config).to receive(:path_accessible?).with(to_platform("/var/cache")).and_return(true)
71 expect(ChefConfig::Config[:cache_path]).to eq(primary_cache_path)
75 - context "when /var/chef does not exist and /var is not accessible" do
76 + context "when /var/cache/chef does not exist and /var is not accessible" do
77 it "defaults to $HOME/.chef" do
78 - allow(File).to receive(:exists?).with(to_platform("/var/chef")).and_return(false)
79 - allow(ChefConfig::Config).to receive(:path_accessible?).with(to_platform("/var")).and_return(false)
80 + allow(File).to receive(:exists?).with(to_platform("/var/cache/chef")).and_return(false)
81 + allow(ChefConfig::Config).to receive(:path_accessible?).with(to_platform("/var/cache")).and_return(false)
82 expect(ChefConfig::Config[:cache_path]).to eq(secondary_cache_path)
86 - context "when /var/chef exists and is not accessible" do
87 + context "when /var/cache/chef exists and is not accessible" do
88 it "defaults to $HOME/.chef" do
89 - allow(File).to receive(:exists?).with(to_platform("/var/chef")).and_return(true)
90 - allow(File).to receive(:readable?).with(to_platform("/var/chef")).and_return(true)
91 - allow(File).to receive(:writable?).with(to_platform("/var/chef")).and_return(false)
92 + allow(File).to receive(:exists?).with(to_platform("/var/cache/chef")).and_return(true)
93 + allow(File).to receive(:readable?).with(to_platform("/var/cache/chef")).and_return(true)
94 + allow(File).to receive(:writable?).with(to_platform("/var/cache/chef")).and_return(false)
96 expect(ChefConfig::Config[:cache_path]).to eq(secondary_cache_path)
99 expect(ChefConfig::Config[:download_progress_interval]).to eq(10)
102 - it "ChefConfig::Config[:file_backup_path] defaults to /var/chef/backup" do
103 - allow(ChefConfig::Config).to receive(:cache_path).and_return(primary_cache_path)
104 - backup_path = is_windows ? "#{primary_cache_path}\\backup" : "#{primary_cache_path}/backup"
105 - expect(ChefConfig::Config[:file_backup_path]).to eq(backup_path)
106 + it "ChefConfig::Config[:file_backup_path] defaults to /var/lib/chef/backup" do
107 + expect(ChefConfig::Config[:file_backup_path]).to eq("/var/lib/chef/backup")
110 it "ChefConfig::Config[:ssl_verify_mode] defaults to :verify_peer" do
111 @@ -568,19 +566,19 @@
115 - it "ChefConfig::Config[:data_bag_path] defaults to /var/chef/data_bags" do
116 + it "ChefConfig::Config[:data_bag_path] defaults to /var/cache/chef/data_bags" do
117 allow(ChefConfig::Config).to receive(:cache_path).and_return(primary_cache_path)
118 data_bag_path = is_windows ? "#{primary_cache_path}\\data_bags" : "#{primary_cache_path}/data_bags"
119 expect(ChefConfig::Config[:data_bag_path]).to eq(data_bag_path)
122 - it "ChefConfig::Config[:environment_path] defaults to /var/chef/environments" do
123 + it "ChefConfig::Config[:environment_path] defaults to /var/cache/chef/environments" do
124 allow(ChefConfig::Config).to receive(:cache_path).and_return(primary_cache_path)
125 environment_path = is_windows ? "#{primary_cache_path}\\environments" : "#{primary_cache_path}/environments"
126 expect(ChefConfig::Config[:environment_path]).to eq(environment_path)
129 - it "ChefConfig::Config[:cookbook_artifact_path] defaults to /var/chef/cookbook_artifacts" do
130 + it "ChefConfig::Config[:cookbook_artifact_path] defaults to /var/cache/chef/cookbook_artifacts" do
131 allow(ChefConfig::Config).to receive(:cache_path).and_return(primary_cache_path)
132 environment_path = is_windows ? "#{primary_cache_path}\\cookbook_artifacts" : "#{primary_cache_path}/cookbook_artifacts"
133 expect(ChefConfig::Config[:cookbook_artifact_path]).to eq(environment_path)
134 --- chef-14.1.21/lib/chef/handler/json_file.rb~ 2018-05-21 18:22:54.000000000 +0200
135 +++ chef-14.1.21/lib/chef/handler/json_file.rb 2018-07-14 22:11:41.547750482 +0200
138 def initialize(config = {})
140 - @config[:path] ||= "/var/chef/reports"
141 + @config[:path] ||= "/var/lib/chef/reports"
145 --- chef-14.1.21/spec/support/shared/context/client.rb~ 2018-05-21 18:22:54.000000000 +0200
146 +++ chef-14.1.21/spec/support/shared/context/client.rb 2018-07-14 22:12:36.736009017 +0200
150 Chef::Config[:client_fork] = enable_fork
151 - Chef::Config[:cache_path] = windows? ? 'C:\chef' : "/var/chef"
152 + Chef::Config[:cache_path] = windows? ? 'C:\chef' : "/var/cache/chef"
153 Chef::Config[:why_run] = false
154 Chef::Config[:audit_mode] = :enabled
155 Chef::Config[:chef_guid] = "default-guid"
156 --- chef-14.1.21/spec/support/shared/context/config.rb~ 2018-05-21 18:22:54.000000000 +0200
157 +++ chef-14.1.21/spec/support/shared/context/config.rb 2018-07-14 22:12:53.026479395 +0200
159 # Basic config. Nothing fancy.
160 shared_context "default config options" do
162 - Chef::Config[:cache_path] = windows? ? 'C:\chef' : "/var/chef"
163 + Chef::Config[:cache_path] = windows? ? 'C:\chef' : "/var/cache/chef"
166 # Don't need to have an after block to reset the config...
167 --- chef-14.1.21/spec/unit/application/solo_spec.rb~ 2018-05-21 18:22:54.000000000 +0200
168 +++ chef-14.1.21/spec/unit/application/solo_spec.rb 2018-07-14 22:13:57.265002987 +0200
169 @@ -206,10 +206,10 @@
172 it "sets the repo path" do
173 - expect(Chef::Config).to receive(:find_chef_repo_path).and_return("/var/chef")
174 + expect(Chef::Config).to receive(:find_chef_repo_path).and_return("/var/lib/chef")
176 expect(Chef::Config.has_key?(:chef_repo_path)).to be_truthy
177 - expect(Chef::Config[:chef_repo_path]).to eq ("/var/chef")
178 + expect(Chef::Config[:chef_repo_path]).to eq ("/var/lib/chef")
181 it "runs chef-client in local mode" do
182 --- chef-14.1.21/spec/unit/cookbook/file_vendor_spec.rb~ 2018-05-21 18:22:54.000000000 +0200
183 +++ chef-14.1.21/spec/unit/cookbook/file_vendor_spec.rb 2018-07-14 22:14:31.759334653 +0200
186 context "when configured to load files from disk" do
188 - let(:cookbook_path) { %w{/var/chef/cookbooks /var/chef/other_cookbooks} }
189 + let(:cookbook_path) { %w{/var/lib/chef/cookbooks /var/lib/chef/other_cookbooks} }
192 cbv = Chef::CookbookVersion.new("bob", Array(Dir.tmpdir))
193 --- chef-14.1.21/spec/unit/data_bag_spec.rb~ 2018-05-21 18:22:54.000000000 +0200
194 +++ chef-14.1.21/spec/unit/data_bag_spec.rb 2018-07-14 22:15:36.734550542 +0200
195 @@ -243,17 +243,17 @@
198 Chef::DataBag.load("foo")
199 - end.to raise_error Chef::Exceptions::InvalidDataBagPath, "Data bag path '/var/chef/data_bags' is invalid"
200 + end.to raise_error Chef::Exceptions::InvalidDataBagPath, "Data bag path '/var/cache/chef/data_bags' is invalid"
205 describe "data bag with string path" do
206 - it_should_behave_like "data bag in solo mode", "/var/chef/data_bags"
207 + it_should_behave_like "data bag in solo mode", "/var/cache/chef/data_bags"
210 describe "data bag with array path" do
211 - it_should_behave_like "data bag in solo mode", ["/var/chef/data_bags", "/var/chef/data_bags_2"]
212 + it_should_behave_like "data bag in solo mode", ["/var/cache/chef/data_bags", "/var/cache/chef/data_bags_2"]
216 --- chef-14.1.21/spec/unit/environment_spec.rb~ 2018-05-21 18:22:54.000000000 +0200
217 +++ chef-14.1.21/spec/unit/environment_spec.rb 2018-07-14 22:16:20.332481816 +0200
219 describe "in solo mode" do
221 Chef::Config[:solo_legacy_mode] = true
222 - Chef::Config[:environment_path] = "/var/chef/environments"
223 + Chef::Config[:environment_path] = "/var/cache/chef/environments"
230 Chef::Environment.load("foo")
231 - end.to raise_error Chef::Exceptions::InvalidEnvironmentPath, "Environment path '/var/chef/environments' is invalid"
232 + end.to raise_error Chef::Exceptions::InvalidEnvironmentPath, "Environment path '/var/cache/chef/environments' is invalid"
235 it "should raise an error if the file does not exist" do
236 --- chef-14.1.21/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb~ 2018-05-21 18:22:54.000000000 +0200
237 +++ chef-14.1.21/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb 2018-07-14 22:17:33.390766108 +0200
239 @outputter = Chef::Formatters::IndentableOutputStream.new(@stdout, STDERR)
240 #@outputter = Chef::Formatters::IndentableOutputStream.new(STDOUT, STDERR)
242 - allow(Chef::Config).to receive(:cookbook_path).and_return([ "/var/chef/cache" ])
243 + allow(Chef::Config).to receive(:cookbook_path).and_return([ "/var/lib/chef" ])
246 describe "when explaining an error converging a resource" do
251 - "/var/chef/cache/cookbooks/syntax-err/recipes/default.rb:14:in `from_file'",
252 - "/var/chef/cache/cookbooks/syntax-err/recipes/default.rb:11:in `from_file'",
253 + "/var/lib/chef/cookbooks/syntax-err/recipes/default.rb:14:in `from_file'",
254 + "/var/lib/chef/cookbooks/syntax-err/recipes/default.rb:11:in `from_file'",
255 "/usr/local/lib/ruby/gems/chef/lib/chef/client.rb:123:in `run'" # should not display
257 @exception = Chef::Exceptions::Package.new("No such package 'non-existing-package'")
260 it "filters chef core code from the backtrace" do
261 @expected_filtered_trace = [
262 - "/var/chef/cache/cookbooks/syntax-err/recipes/default.rb:14:in `from_file'",
263 - "/var/chef/cache/cookbooks/syntax-err/recipes/default.rb:11:in `from_file'",
264 + "/var/lib/chef/cookbooks/syntax-err/recipes/default.rb:14:in `from_file'",
265 + "/var/lib/chef/cookbooks/syntax-err/recipes/default.rb:11:in `from_file'",
268 expect(@inspector.filtered_bt).to eq(@expected_filtered_trace)
269 --- chef-14.1.21/spec/unit/role_spec.rb~ 2018-05-21 18:22:54.000000000 +0200
270 +++ chef-14.1.21/spec/unit/role_spec.rb 2018-07-14 22:18:45.421896466 +0200
273 describe "when loading from disk" do
275 - default_cache_path = windows? ? 'C:\chef' : "/var/chef"
276 + default_cache_path = windows? ? 'C:\chef' : "/var/cache/chef"
277 allow(Chef::Config).to receive(:cache_path).and_return(default_cache_path)
280 --- chef-14.1.21/spec/unit/run_lock_spec.rb~ 2018-05-21 18:22:54.000000000 +0200
281 +++ chef-14.1.21/spec/unit/run_lock_spec.rb 2018-07-14 22:19:37.309448017 +0200
284 describe Chef::RunLock do
286 - default_cache_path = windows? ? 'C:\chef' : "/var/chef"
287 - default_pid_location = windows? ? 'C:\chef\cache\chef-client-running.pid' : "/var/chef/cache/chef-client-running.pid"
288 + default_cache_path = windows? ? 'C:\chef' : "/var/cache/chef"
289 + default_pid_location = windows? ? 'C:\chef\cache\chef-client-running.pid' : "/var/cache/chef/chef-client-running.pid"
291 describe "when first created" do
292 it "locates the lockfile in the file cache path by default" do