chef 13.0.113-universal-mingw32 → 13.0.118-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c93d79bf64bf645d51d6ee5b24ff4ef9ccfcecb
4
- data.tar.gz: e5b74d8181ae4f16bd494c1503ed13b7c170b5be
3
+ metadata.gz: 7fc7f0e81269f48b6449161ed3cb8c15bdd54d6c
4
+ data.tar.gz: 67b0882342404cab056cb7f6bc7501861720605b
5
5
  SHA512:
6
- metadata.gz: 9c33831a2db5c1d28c7b39370a6d379e15bab3c49229042ab184b48e35b41b8b9c15f5fc3b2ccc5571f1b222552e8cc9b260210302b59739c76797c5836b8236
7
- data.tar.gz: 5520e7b2b6d1bad1e9e058a0d0031aebc248c8eaceb63331716d59904e84efe7d0e2bf0ae74463cc17938b4098c4d4a2246c946bc674166ed6fea61d957836b1
6
+ metadata.gz: 2b80bafea21ed673fe5b3d3acc65f3c1683f7a5bf23117635f158f44391fbf08fad59d6aa170bf9fe1b5a6eee0b3f8a57593f0188a1f3ba645307d363165933e
7
+ data.tar.gz: f82b13cddafe20163e6ab5fecdc9c616df1e8a05c8f58b5db46a456e50661ec584aaf4c55709b73f810c493e9e7f72dc199640a37f06643ef0263f6878301e4c
data/VERSION CHANGED
@@ -1 +1 @@
1
- 13.0.113
1
+ 13.0.118
@@ -1 +1 @@
1
- #kitchen "destroy"
1
+ kitchen "destroy"
@@ -1 +1 @@
1
- #kitchen "converge"
1
+ kitchen "converge"
@@ -1 +1 @@
1
- #kitchen "verify"
1
+ kitchen "verify"
data/lib/chef/client.rb CHANGED
@@ -532,6 +532,7 @@ class Chef
532
532
  #
533
533
  def load_required_recipe(rest, run_context)
534
534
  required_recipe_contents = rest.get("required_recipe")
535
+ Chef::Log.info("Required Recipe found, loading it")
535
536
  Chef::FileCache.store("required_recipe", required_recipe_contents)
536
537
  required_recipe_file = Chef::FileCache.load("required_recipe", false)
537
538
 
@@ -552,7 +553,7 @@ class Chef
552
553
  rescue Net::HTTPServerException => e
553
554
  case e.response
554
555
  when Net::HTTPNotFound
555
- Chef::Log.info("Required Recipe not found")
556
+ Chef::Log.debug("Required Recipe not configured on the server, skipping it")
556
557
  else
557
558
  raise
558
559
  end
@@ -27,13 +27,14 @@ class Chef
27
27
  COOKBOOK_SEGMENTS = %w{ resources providers recipes definitions libraries attributes files templates root_files }
28
28
 
29
29
  def self.from_hash(hash)
30
- response = Mash.new
30
+ response = Mash.new(hash)
31
31
  response[:all_files] = COOKBOOK_SEGMENTS.inject([]) do |memo, segment|
32
32
  next memo if hash[segment].nil? || hash[segment].empty?
33
33
  hash[segment].each do |file|
34
34
  file["name"] = "#{segment}/#{file["name"]}" unless segment == "root_files"
35
35
  memo << file
36
36
  end
37
+ response.delete(segment)
37
38
  memo
38
39
  end
39
40
  response
@@ -44,7 +45,7 @@ class Chef
44
45
  result.delete("all_files")
45
46
 
46
47
  files = manifest.by_parent_directory
47
- files.keys.inject(result) do |memo, parent|
48
+ files.keys.each_with_object(result) do |parent, memo|
48
49
  if COOKBOOK_SEGMENTS.include?(parent)
49
50
  memo[parent] ||= []
50
51
  files[parent].each do |file|
@@ -53,7 +54,11 @@ class Chef
53
54
  memo[parent] << file
54
55
  end
55
56
  end
56
- memo
57
+ end
58
+ # Ensure all segments are set to [] if they don't exist.
59
+ # See https://github.com/chef/chef/issues/6044
60
+ COOKBOOK_SEGMENTS.each do |segment|
61
+ result[segment] ||= []
57
62
  end
58
63
 
59
64
  result.merge({ "frozen?" => manifest.frozen_version?, "chef_type" => "cookbook_version" })
@@ -297,7 +297,11 @@ class Chef
297
297
  def expand_options(options)
298
298
  # its deprecated but still work to do to deprecate it fully
299
299
  #Chef.deprecated(:package_misc, "expand_options is deprecated, use shell_out_compact or shell_out_compact_timeout instead")
300
- options ? " #{options}" : ""
300
+ if options
301
+ " #{options.is_a?(Array) ? Shellwords.join(options) : options}"
302
+ else
303
+ ""
304
+ end
301
305
  end
302
306
 
303
307
  # Check the current_version against either the candidate_version or the new_version
@@ -194,7 +194,7 @@ class Chef
194
194
  def manage_extra_repo_control
195
195
  if new_resource.options
196
196
  repo_control = []
197
- new_resource.options.split.each do |opt|
197
+ new_resource.options.each do |opt|
198
198
  repo_control << opt if opt =~ /--(enable|disable)repo=.+/
199
199
  end
200
200
 
data/lib/chef/version.rb CHANGED
@@ -21,7 +21,7 @@
21
21
 
22
22
  class Chef
23
23
  CHEF_ROOT = File.expand_path("../..", __FILE__)
24
- VERSION = "13.0.113"
24
+ VERSION = "13.0.118"
25
25
  end
26
26
 
27
27
  #
@@ -437,7 +437,7 @@ EOM
437
437
  end
438
438
 
439
439
  it "should log and continue on" do
440
- expect(Chef::Log).to receive(:info)
440
+ expect(Chef::Log).to receive(:debug)
441
441
  client.load_required_recipe(rest, run_context)
442
442
  end
443
443
  end
@@ -0,0 +1,133 @@
1
+ #
2
+ # Copyright:: Copyright 2017, Chef Software Inc.
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require "spec_helper"
18
+ require "chef/cookbook_manifest"
19
+ require "chef/digester"
20
+ require "pathname"
21
+
22
+ describe Chef::Cookbook::ManifestV0 do
23
+ let(:version) { "1.2.3" }
24
+
25
+ let(:identifier) { "9e10455ce2b4a4e29424b7064b1d67a1a25c9d3b" }
26
+
27
+ let(:metadata) do
28
+ Chef::Cookbook::Metadata.new.tap do |m|
29
+ m.version(version)
30
+ end
31
+ end
32
+
33
+ let(:cookbook_root) { "/tmp/blah" }
34
+
35
+ let(:cookbook_version) do
36
+ Chef::CookbookVersion.new("tatft", cookbook_root).tap do |c|
37
+ c.metadata = metadata
38
+ c.identifier = identifier
39
+ end
40
+ end
41
+
42
+ let(:cookbook_manifest) { Chef::CookbookManifest.new(cookbook_version) }
43
+
44
+ let(:cookbook_root) { File.join(CHEF_SPEC_DATA, "cb_version_cookbooks", "tatft") }
45
+
46
+ let(:all_files) { Dir[File.join(cookbook_root, "**", "**")].reject { |f| File.directory? f } }
47
+
48
+ let(:expected_hash) do
49
+ {
50
+ "attributes" => [{ "name" => "default.rb", "path" => "attributes/default.rb", "checksum" => "a88697db56181498a8828d5531271ad9", "specificity" => "default" }],
51
+ "chef_type" => "cookbook_version",
52
+ "cookbook_name" => "tatft",
53
+ "definitions" => [{ "name" => "runit_service.rb", "path" => "definitions/runit_service.rb", "checksum" => "c40cf9b4c6eb15a8e49e31602f701161", "specificity" => "default" }],
54
+ "files" => [{ "name" => "giant_blob.tgz", "path" => "files/default/giant_blob.tgz", "checksum" => "5b4b194bb80938bb18da7af5c823cb1b", "specificity" => "default" }],
55
+ "frozen?" => false,
56
+ "libraries" => [{ "name" => "ownage.rb", "path" => "libraries/ownage.rb", "checksum" => "4686edd9968909034692e09e058d90d9", "specificity" => "default" }],
57
+ "name" => "tatft-1.2.3",
58
+ "providers" => [{ "name" => "lwp.rb", "path" => "providers/lwp.rb", "checksum" => "bc189d68f77bb054d1070aeff7669557", "specificity" => "default" }],
59
+ "recipes" => [{ "name" => "default.rb", "path" => "recipes/default.rb", "checksum" => "09bc749f00c68717d288de9c8d7c644f", "specificity" => "default" }],
60
+ "resources" => [{ "name" => "lwr.rb", "path" => "resources/lwr.rb", "checksum" => "609c40d3d3f269e7edf230277a240ef5", "specificity" => "default" }],
61
+ "root_files" => [{ "name" => "README.rdoc", "path" => "README.rdoc", "checksum" => "cd7be9a1b9b1f33e3bcd9c3f4bc8dde5", "specificity" => "default" }],
62
+ "templates" => [{ "name" => "configuration.erb", "path" => "templates/default/configuration.erb", "checksum" => "d41d8cd98f00b204e9800998ecf8427e", "specificity" => "default" }],
63
+ "version" => "1.2.3",
64
+ }
65
+ end
66
+
67
+ describe "#from_hash" do
68
+ let(:source_hash) do
69
+ {
70
+ "attributes" => [{ "name" => "default.rb", "path" => "attributes/default.rb", "checksum" => "a88697db56181498a8828d5531271ad9", "specificity" => "default" }],
71
+ "recipes" => [{ "name" => "default.rb", "path" => "recipes/default.rb", "checksum" => "09bc749f00c68717d288de9c8d7c644f", "specificity" => "default" }],
72
+ "root_files" => [{ "name" => "README.rdoc", "path" => "README.rdoc", "checksum" => "cd7be9a1b9b1f33e3bcd9c3f4bc8dde5", "specificity" => "default" }],
73
+ "name" => "tatft-1.2.3",
74
+ "version" => "1.2.3",
75
+ }
76
+ end
77
+
78
+ it "preserves the version" do
79
+ result = described_class.from_hash(source_hash)
80
+ expect(result["version"]).to eq "1.2.3"
81
+ end
82
+
83
+ it "creates an all_files key and populates it" do
84
+ result = described_class.from_hash(source_hash)
85
+ expect(result[:all_files].map { |f| f["name"] }).to match_array %w{ recipes/default.rb attributes/default.rb README.rdoc }
86
+ end
87
+
88
+ it "deletes unwanted segment types" do
89
+ result = described_class.from_hash(source_hash)
90
+ expect(result["attributes"]).to be_nil
91
+ end
92
+
93
+ it "preserves frozeness" do
94
+ source_hash["frozen?"] = true
95
+ result = described_class.from_hash(source_hash)
96
+ expect(result["frozen?"]).to be true
97
+ end
98
+ end
99
+
100
+ describe "#to_hash" do
101
+ it "accepts a cookbook manifest" do
102
+ result = described_class.to_hash(cookbook_manifest)
103
+ expect(result).to be_a(Hash)
104
+ end
105
+
106
+ it "preserves frozeness" do
107
+ cookbook_version.freeze_version
108
+ expect(described_class.to_hash(cookbook_manifest)["frozen?"]).to be true
109
+ end
110
+ end
111
+
112
+ context "ensures that all segments exist" do
113
+ Chef::Cookbook::ManifestV0::COOKBOOK_SEGMENTS.each do |segment|
114
+ it "with #{segment}" do
115
+ result = described_class.to_hash(cookbook_manifest)
116
+ expect(result[segment]).to be_empty
117
+ end
118
+ end
119
+ end
120
+
121
+ context "when given a cookbook with some files" do
122
+ before do
123
+ cookbook_version.all_files = all_files
124
+ end
125
+
126
+ Chef::Cookbook::ManifestV0::COOKBOOK_SEGMENTS.each do |segment|
127
+ it "places the files for #{segment} correctly" do
128
+ result = described_class.to_hash(cookbook_manifest)
129
+ expect(result[segment]).to eq(expected_hash[segment])
130
+ end
131
+ end
132
+ end
133
+ end
@@ -0,0 +1,70 @@
1
+ #
2
+ # Copyright:: Copyright 2017, Chef Software Inc.
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require "spec_helper"
18
+ require "chef/cookbook_manifest"
19
+ require "chef/digester"
20
+ require "pathname"
21
+
22
+ describe Chef::Cookbook::ManifestV2 do
23
+ let(:version) { "1.2.3" }
24
+
25
+ let(:identifier) { "9e10455ce2b4a4e29424b7064b1d67a1a25c9d3b" }
26
+
27
+ let(:metadata) do
28
+ Chef::Cookbook::Metadata.new.tap do |m|
29
+ m.version(version)
30
+ end
31
+ end
32
+
33
+ let(:cookbook_root) { "/tmp/blah" }
34
+
35
+ let(:cookbook_version) do
36
+ Chef::CookbookVersion.new("tatft", cookbook_root).tap do |c|
37
+ c.metadata = metadata
38
+ c.identifier = identifier
39
+ end
40
+ end
41
+
42
+ let(:cookbook_manifest) { Chef::CookbookManifest.new(cookbook_version) }
43
+
44
+ let(:cookbook_root) { File.join(CHEF_SPEC_DATA, "cb_version_cookbooks", "tatft") }
45
+
46
+ let(:all_files) { Dir[File.join(cookbook_root, "**", "**")].reject { |f| File.directory? f } }
47
+
48
+ describe "#to_hash" do
49
+ it "accepts a cookbook manifest" do
50
+ result = described_class.to_hash(cookbook_manifest)
51
+ expect(result).to be_a(Hash)
52
+ end
53
+
54
+ it "preserves frozeness" do
55
+ cookbook_version.freeze_version
56
+ expect(described_class.to_hash(cookbook_manifest)["frozen?"]).to be true
57
+ end
58
+ end
59
+
60
+ context "when given a cookbook with some files" do
61
+ before do
62
+ cookbook_version.all_files = all_files
63
+ end
64
+
65
+ it "populates all_files correctly" do
66
+ result = described_class.to_hash(cookbook_manifest)
67
+ expect(result["all_files"][0]).not_to include(:full_path)
68
+ end
69
+ end
70
+ end
@@ -278,31 +278,31 @@ describe Chef::Provider::Package::Yum do
278
278
  end
279
279
 
280
280
  it "should flush the cache if :before is true" do
281
- allow(@new_resource).to receive(:flush_cache).and_return({ :after => false, :before => true })
281
+ @new_resource.flush_cache({ :after => false, :before => true })
282
282
  expect(@yum_cache).to receive(:reload).once
283
283
  @provider.load_current_resource
284
284
  end
285
285
 
286
286
  it "should flush the cache if :before is false" do
287
- allow(@new_resource).to receive(:flush_cache).and_return({ :after => false, :before => false })
287
+ @new_resource.flush_cache({ :after => false, :before => false })
288
288
  expect(@yum_cache).not_to receive(:reload)
289
289
  @provider.load_current_resource
290
290
  end
291
291
 
292
292
  it "should detect --enablerepo or --disablerepo when passed among options, collect them preserving order and notify the yum cache" do
293
- allow(@new_resource).to receive(:options).and_return("--stuff --enablerepo=foo --otherthings --disablerepo=a,b,c --enablerepo=bar")
293
+ @new_resource.options("--stuff --enablerepo=foo --otherthings --disablerepo=a,b,c --enablerepo=bar")
294
294
  expect(@yum_cache).to receive(:enable_extra_repo_control).with("--enablerepo=foo --disablerepo=a,b,c --enablerepo=bar")
295
295
  @provider.load_current_resource
296
296
  end
297
297
 
298
298
  it "should let the yum cache know extra repos are disabled if --enablerepo or --disablerepo aren't among options" do
299
- allow(@new_resource).to receive(:options).and_return("--stuff --otherthings")
299
+ @new_resource.options("--stuff --otherthings")
300
300
  expect(@yum_cache).to receive(:disable_extra_repo_control)
301
301
  @provider.load_current_resource
302
302
  end
303
303
 
304
304
  it "should let the yum cache know extra repos are disabled if options aren't set" do
305
- allow(@new_resource).to receive(:options).and_return(nil)
305
+ @new_resource.options(nil)
306
306
  expect(@yum_cache).to receive(:disable_extra_repo_control)
307
307
  @provider.load_current_resource
308
308
  end
@@ -558,7 +558,7 @@ describe Chef::Provider::Package::Yum do
558
558
  it "installs the package with the options given in the resource" do
559
559
  @provider.load_current_resource
560
560
  allow(@provider).to receive(:candidate_version).and_return("11")
561
- allow(@new_resource).to receive(:options).and_return("--disablerepo epmd")
561
+ @new_resource.options("--disablerepo epmd")
562
562
  allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1)
563
563
  expect(@provider).to receive(:yum_command).with(
564
564
  "-d0 -e0 -y --disablerepo epmd install cups-11"
@@ -2261,7 +2261,7 @@ describe "Chef::Provider::Package::Yum - Multi" do
2261
2261
  expect(@provider).to receive(:yum_command).with(
2262
2262
  "-d0 -e0 -y --disablerepo epmd install cups-1.2.4-11.19.el5 vim-1.0"
2263
2263
  )
2264
- allow(@new_resource).to receive(:options).and_return("--disablerepo epmd")
2264
+ @new_resource.options("--disablerepo epmd")
2265
2265
  @provider.install_package(%w{cups vim}, ["1.2.4-11.19.el5", "1.0"])
2266
2266
  end
2267
2267
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.0.113
4
+ version: 13.0.118
5
5
  platform: universal-mingw32
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-06 00:00:00.000000000 Z
11
+ date: 2017-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-config
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 13.0.113
19
+ version: 13.0.118
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 13.0.113
26
+ version: 13.0.118
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mixlib-cli
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -2295,6 +2295,8 @@ files:
2295
2295
  - spec/unit/cookbook/cookbook_version_loader_spec.rb
2296
2296
  - spec/unit/cookbook/file_vendor_spec.rb
2297
2297
  - spec/unit/cookbook/gem_installer_spec.rb
2298
+ - spec/unit/cookbook/manifest_v0_spec.rb
2299
+ - spec/unit/cookbook/manifest_v2_spec.rb
2298
2300
  - spec/unit/cookbook/metadata_spec.rb
2299
2301
  - spec/unit/cookbook/synchronizer_spec.rb
2300
2302
  - spec/unit/cookbook/syntax_check_spec.rb