chef-config 12.16.42 → 12.17.44
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef-config/config.rb +19 -2
- data/lib/chef-config/version.rb +1 -1
- data/spec/unit/config_spec.rb +38 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5c7dce34f87ebf0e8884f03e9118dcb77afb169
|
4
|
+
data.tar.gz: b46529667bbff8dcb5f16c8caa4dc65c4dcdbb80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd808dfda9ba35ef69775abe07e45718b8937f1d8f8953903e57b78e59f7a5b4188e98415c25878a1bb168fced1ab35e8febe1e68793bccce5d0ae85adf356f9
|
7
|
+
data.tar.gz: b9fac9c752ecef7ca23ac81b8c7cc35024a8fec7c861f952bae7846b40f2ebfddd45a675040ea11e09e3733d91816b872b6e19e3d08f614f7fe1ff80d4bc7c39
|
data/lib/chef-config/config.rb
CHANGED
@@ -56,13 +56,24 @@ module ChefConfig
|
|
56
56
|
path = PathHelper.cleanpath(path)
|
57
57
|
if ChefConfig.windows?
|
58
58
|
# turns \etc\chef\client.rb and \var\chef\client.rb into C:/chef/client.rb
|
59
|
-
|
60
|
-
|
59
|
+
# Some installations will be on different drives so use the drive that
|
60
|
+
# the expanded path to __FILE__ is found.
|
61
|
+
drive = windows_installation_drive
|
62
|
+
if drive && path[0] == '\\' && path.split('\\')[2] == "chef"
|
63
|
+
path = PathHelper.join(drive, path.split('\\', 3)[2])
|
61
64
|
end
|
62
65
|
end
|
63
66
|
path
|
64
67
|
end
|
65
68
|
|
69
|
+
def self.windows_installation_drive
|
70
|
+
if ChefConfig.windows?
|
71
|
+
drive = File.expand_path(__FILE__).split("/", 2)[0]
|
72
|
+
drive = ENV["SYSTEMDRIVE"] if drive.to_s == ""
|
73
|
+
drive
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
66
77
|
def self.add_formatter(name, file_path = nil)
|
67
78
|
formatters << [name, file_path]
|
68
79
|
end
|
@@ -1042,6 +1053,12 @@ module ChefConfig
|
|
1042
1053
|
|
1043
1054
|
default :rubygems_url, "https://rubygems.org"
|
1044
1055
|
|
1056
|
+
# This controls the behavior of resource cloning (and CHEF-3694 warnings). For Chef < 12 the behavior
|
1057
|
+
# has been that this is 'true', in Chef 13 this will change to false. Setting this to 'true' in Chef
|
1058
|
+
# 13 is not a viable or supported migration strategy since Chef 13 community cookbooks will be expected
|
1059
|
+
# to break with this setting set to 'true'.
|
1060
|
+
default :resource_cloning, true
|
1061
|
+
|
1045
1062
|
# If installed via an omnibus installer, this gives the path to the
|
1046
1063
|
# "embedded" directory which contains all of the software packaged with
|
1047
1064
|
# omnibus. This is used to locate the cacert.pem file on windows.
|
data/lib/chef-config/version.rb
CHANGED
data/spec/unit/config_spec.rb
CHANGED
@@ -203,16 +203,41 @@ RSpec.describe ChefConfig::Config do
|
|
203
203
|
before :each do
|
204
204
|
allow(ChefConfig).to receive(:windows?).and_return(is_windows)
|
205
205
|
end
|
206
|
-
|
206
|
+
describe "class method: windows_installation_drive" do
|
207
|
+
before do
|
208
|
+
allow(File).to receive(:expand_path).and_return("D:/Path/To/Executable")
|
209
|
+
end
|
210
|
+
if is_windows
|
211
|
+
it "should return D: on a windows system" do
|
212
|
+
expect(ChefConfig::Config.windows_installation_drive).to eq("D:")
|
213
|
+
end
|
214
|
+
else
|
215
|
+
it "should return nil on a non-windows system" do
|
216
|
+
expect(ChefConfig::Config.windows_installation_drive).to eq(nil)
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
207
220
|
describe "class method: platform_specific_path" do
|
221
|
+
before do
|
222
|
+
allow(ChefConfig::Config).to receive(:env).and_return({ "SYSTEMDRIVE" => "C:" })
|
223
|
+
end
|
208
224
|
if is_windows
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
225
|
+
path = "/etc/chef/cookbooks"
|
226
|
+
context "a windows system with chef installed on C: drive" do
|
227
|
+
before do
|
228
|
+
allow(ChefConfig::Config).to receive(:windows_installation_drive).and_return("C:")
|
229
|
+
end
|
230
|
+
it "should return a windows path rooted in C:" do
|
231
|
+
expect(ChefConfig::Config.platform_specific_path(path)).to eq("C:\\chef\\cookbooks")
|
232
|
+
end
|
233
|
+
end
|
234
|
+
context "a windows system with chef installed on D: drive" do
|
235
|
+
before do
|
236
|
+
allow(ChefConfig::Config).to receive(:windows_installation_drive).and_return("D:")
|
237
|
+
end
|
238
|
+
it "should return a windows path rooted in D:" do
|
239
|
+
expect(ChefConfig::Config.platform_specific_path(path)).to eq("D:\\chef\\cookbooks")
|
240
|
+
end
|
216
241
|
end
|
217
242
|
else
|
218
243
|
it "should return given path on non-windows systems" do
|
@@ -345,6 +370,11 @@ RSpec.describe ChefConfig::Config do
|
|
345
370
|
end
|
346
371
|
|
347
372
|
describe "ChefConfig::Config[:cache_path]" do
|
373
|
+
before do
|
374
|
+
if is_windows
|
375
|
+
allow(File).to receive(:expand_path).and_return("#{ChefConfig::Config.env["SYSTEMDRIVE"]}/Path/To/Executable")
|
376
|
+
end
|
377
|
+
end
|
348
378
|
context "when /var/chef exists and is accessible" do
|
349
379
|
it "defaults to /var/chef" do
|
350
380
|
allow(ChefConfig::Config).to receive(:path_accessible?).with(to_platform("/var/chef")).and_return(true)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 12.
|
4
|
+
version: 12.17.44
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-shellout
|