chef 16.8.9 → 16.9.29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -4
  3. data/README.md +1 -1
  4. data/chef.gemspec +11 -2
  5. data/lib/chef/compliance/default_attributes.rb +5 -1
  6. data/lib/chef/compliance/fetcher/automate.rb +2 -2
  7. data/lib/chef/compliance/fetcher/chef_server.rb +2 -2
  8. data/lib/chef/compliance/reporter/automate.rb +1 -2
  9. data/lib/chef/compliance/reporter/chef_server_automate.rb +4 -2
  10. data/lib/chef/compliance/runner.rb +53 -39
  11. data/lib/chef/http/ssl_policies.rb +27 -14
  12. data/lib/chef/knife/core/formatting_options.rb +49 -0
  13. data/lib/chef/knife/core/node_presenter.rb +0 -25
  14. data/lib/chef/knife/core/status_presenter.rb +1 -26
  15. data/lib/chef/knife/core/windows_bootstrap_context.rb +1 -1
  16. data/lib/chef/knife/node_show.rb +2 -1
  17. data/lib/chef/knife/search.rb +2 -1
  18. data/lib/chef/knife/ssh.rb +2 -0
  19. data/lib/chef/knife/status.rb +8 -11
  20. data/lib/chef/policy_builder/policyfile.rb +1 -1
  21. data/lib/chef/provider/package.rb +53 -19
  22. data/lib/chef/provider/package/dnf.rb +39 -12
  23. data/lib/chef/provider/package/dnf/dnf_helper.py +18 -5
  24. data/lib/chef/provider/package/dnf/python_helper.rb +6 -6
  25. data/lib/chef/provider/package/freebsd/pkgng.rb +3 -1
  26. data/lib/chef/provider/yum_repository.rb +2 -2
  27. data/lib/chef/resource/chef_gem.rb +2 -2
  28. data/lib/chef/resource/cron/cron_d.rb +1 -0
  29. data/lib/chef/resource/file.rb +1 -1
  30. data/lib/chef/resource/gem_package.rb +2 -2
  31. data/lib/chef/resource/homebrew_cask.rb +3 -3
  32. data/lib/chef/resource/http_request.rb +1 -1
  33. data/lib/chef/resource/locale.rb +1 -1
  34. data/lib/chef/resource/mdadm.rb +2 -2
  35. data/lib/chef/resource/osx_profile.rb +7 -7
  36. data/lib/chef/resource/remote_directory.rb +1 -1
  37. data/lib/chef/resource/ruby.rb +1 -5
  38. data/lib/chef/resource/ruby_block.rb +1 -1
  39. data/lib/chef/resource/user/windows_user.rb +5 -0
  40. data/lib/chef/resource/windows_certificate.rb +2 -12
  41. data/lib/chef/resource/yum_repository.rb +5 -0
  42. data/lib/chef/shell.rb +32 -1
  43. data/lib/chef/version.rb +1 -1
  44. data/spec/data/rubygems.org/latest_specs.4.8.gz +0 -0
  45. data/spec/data/rubygems.org/nonexistent_gem +0 -0
  46. data/spec/data/rubygems.org/sexp_processor +0 -0
  47. data/spec/data/rubygems.org/sexp_processor-4.15.1.gemspec.rz +0 -0
  48. data/spec/data/ssl/binary/chef-rspec-der.cert +0 -0
  49. data/spec/data/ssl/binary/chef-rspec-der.key +0 -0
  50. data/spec/functional/resource/dnf_package_spec.rb +319 -16
  51. data/spec/functional/resource/ohai_spec.rb +2 -10
  52. data/spec/functional/resource/windows_certificate_spec.rb +204 -384
  53. data/spec/spec_helper.rb +1 -1
  54. data/spec/unit/compliance/runner_spec.rb +60 -7
  55. data/spec/unit/http/ssl_policies_spec.rb +106 -78
  56. data/spec/unit/knife/bootstrap_spec.rb +5 -17
  57. data/spec/unit/knife/core/status_presenter_spec.rb +54 -0
  58. data/spec/unit/mixin/openssl_helper_spec.rb +0 -7
  59. data/spec/unit/provider/package/freebsd/pkgng_spec.rb +1 -1
  60. data/spec/unit/provider/package/rubygems_spec.rb +39 -7
  61. data/spec/unit/resource/user/windows_user_spec.rb +36 -0
  62. metadata +32 -14
  63. data/spec/data/trusted_certs_empty/.gitkeep +0 -0
  64. data/spec/data/trusted_certs_empty/README.md +0 -1
  65. data/spec/scripts/ssl-serve.rb +0 -47
@@ -21,13 +21,6 @@ describe Chef::Mixin::OpenSSLHelper do
21
21
  Class.new { include Chef::Mixin::OpenSSLHelper }.new
22
22
  end
23
23
 
24
- describe ".included" do
25
- it "requires openssl" do
26
- instance
27
- expect(defined?(OpenSSL)).to_not be(false)
28
- end
29
- end
30
-
31
24
  # Path helpers
32
25
  describe "#get_key_filename" do
33
26
  context "When the input is not a string" do
@@ -66,7 +66,7 @@ describe Chef::Provider::Package::Freebsd::Port do
66
66
  end
67
67
 
68
68
  it "should query pkg database" do
69
- expect(@provider).to receive(:shell_out_compacted!).with("pkg", "info", "zsh", env: nil, returns: [0, 70], timeout: 900).and_return(@pkg_info)
69
+ expect(@provider).to receive(:shell_out_compacted!).with("pkg", "info", "zsh", env: nil, returns: [0, 1, 70], timeout: 900).and_return(@pkg_info)
70
70
  expect(@provider.current_installed_version).to eq("3.1.7")
71
71
  end
72
72
  end
@@ -50,6 +50,8 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
50
50
  before do
51
51
  @gem_env = Chef::Provider::Package::Rubygems::CurrentGemEnvironment.new
52
52
  allow(@gem_env).to receive(:logger).and_return(logger)
53
+
54
+ WebMock.disable_net_connect!
53
55
  end
54
56
 
55
57
  it "determines the gem paths from the in memory rubygems" do
@@ -113,28 +115,55 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
113
115
  end
114
116
 
115
117
  it "finds a matching gem candidate version on rubygems 2.0.0+" do
116
- dep = Gem::Dependency.new("rspec", ">= 0")
118
+ stub_request(:head, "https://rubygems.org/api/v1/dependencies")
119
+
120
+ stub_request(:get, "https://rubygems.org/api/v1/dependencies?gems=sexp_processor")
121
+ .to_return(status: 200, body: File.binread(File.join(CHEF_SPEC_DATA, "rubygems.org", "sexp_processor")))
122
+
123
+ stub_request(:get, "https://rubygems.org/quick/Marshal.4.8/sexp_processor-4.15.1.gemspec.rz")
124
+ .to_return(status: 200, body: File.binread(File.join(CHEF_SPEC_DATA, "rubygems.org", "sexp_processor-4.15.1.gemspec.rz")))
125
+
126
+ dep = Gem::Dependency.new("sexp_processor", ">= 0")
117
127
  expect(@gem_env.candidate_version_from_remote(dep)).to be_kind_of(Gem::Version)
118
128
  end
119
129
 
120
130
  it "gives the candidate version as nil if none is found" do
121
- dep = Gem::Dependency.new("lksdjflksdjflsdkfj", ">= 0")
131
+ stub_request(:head, "https://rubygems.org/api/v1/dependencies")
132
+
133
+ stub_request(:get, "https://rubygems.org/api/v1/dependencies?gems=nonexistent_gem")
134
+ .to_return(status: 200, body: File.binread(File.join(CHEF_SPEC_DATA, "rubygems.org", "nonexistent_gem")))
135
+
136
+ dep = Gem::Dependency.new("nonexistent_gem", ">= 0")
122
137
  expect(@gem_env.candidate_version_from_remote(dep)).to be_nil
123
138
  end
124
139
 
125
140
  it "finds a matching gem from a specific gemserver when explicit sources are given (to a server that doesn't respond to api requests)" do
126
- dep = Gem::Dependency.new("rspec", ">= 0")
127
- expect(@gem_env.candidate_version_from_remote(dep, "https://rubygems.org")).to be_kind_of(Gem::Version)
141
+ stub_request(:head, "https://rubygems2.org/api/v1/dependencies")
142
+
143
+ stub_request(:get, "https://rubygems2.org/api/v1/dependencies?gems=sexp_processor")
144
+ .to_return(status: 200, body: File.binread(File.join(CHEF_SPEC_DATA, "rubygems.org", "sexp_processor")))
145
+
146
+ stub_request(:get, "https://rubygems2.org/quick/Marshal.4.8/sexp_processor-4.15.1.gemspec.rz")
147
+ .to_return(status: 200, body: File.binread(File.join(CHEF_SPEC_DATA, "rubygems.org", "sexp_processor-4.15.1.gemspec.rz")))
148
+
149
+ dep = Gem::Dependency.new("sexp_processor", ">= 0")
150
+ expect(@gem_env.candidate_version_from_remote(dep, "https://rubygems2.org")).to be_kind_of(Gem::Version)
128
151
  end
129
152
  end
130
153
 
131
154
  context "old rubygems caching behavior" do
132
155
  before do
133
156
  Chef::Config[:rubygems_cache_enabled] = true
157
+
158
+ stub_request(:get, "https://rubygems.org/latest_specs.4.8.gz")
159
+ .to_return(status: 200, body: File.binread(File.join(CHEF_SPEC_DATA, "rubygems.org", "latest_specs.4.8.gz")))
134
160
  end
135
161
 
136
162
  it "finds a matching gem candidate version on rubygems 2.0.0+" do
137
- dep = Gem::Dependency.new("rspec", ">= 0")
163
+ stub_request(:get, "https://rubygems.org/quick/Marshal.4.8/sexp_processor-4.15.1.gemspec.rz")
164
+ .to_return(status: 200, body: File.binread(File.join(CHEF_SPEC_DATA, "rubygems.org", "sexp_processor-4.15.1.gemspec.rz")))
165
+
166
+ dep = Gem::Dependency.new("sexp_processor", ">= 0")
138
167
  expect(@gem_env.candidate_version_from_remote(dep)).to be_kind_of(Gem::Version)
139
168
  end
140
169
 
@@ -144,8 +173,11 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
144
173
  end
145
174
 
146
175
  it "finds a matching gem from a specific gemserver when explicit sources are given" do
147
- dep = Gem::Dependency.new("rspec", ">= 0")
148
- expect(@gem_env.candidate_version_from_remote(dep, "http://production.cf.rubygems.org")).to be_kind_of(Gem::Version)
176
+ stub_request(:get, "https://rubygems.org/quick/Marshal.4.8/sexp_processor-4.15.1.gemspec.rz")
177
+ .to_return(status: 200, body: File.binread(File.join(CHEF_SPEC_DATA, "rubygems.org", "sexp_processor-4.15.1.gemspec.rz")))
178
+
179
+ dep = Gem::Dependency.new("sexp_processor", ">= 0")
180
+ expect(@gem_env.candidate_version_from_remote(dep, "http://rubygems2.org")).to be_kind_of(Gem::Version)
149
181
  end
150
182
  end
151
183
 
@@ -0,0 +1,36 @@
1
+ #
2
+ # Copyright:: Copyright (c) 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
+
18
+ require "spec_helper"
19
+
20
+ describe Chef::Resource::User::WindowsUser, "#uid" do
21
+ let(:resource) { Chef::Resource::User::WindowsUser.new("notarealuser") }
22
+
23
+ it "allows a string" do
24
+ resource.uid "100"
25
+ expect(resource.uid).to eql(100)
26
+ end
27
+
28
+ it "allows an integer" do
29
+ resource.uid 100
30
+ expect(resource.uid).to eql(100)
31
+ end
32
+
33
+ it "does not allow a hash" do
34
+ expect { resource.uid({ woot: "i found it" }) }.to raise_error(ArgumentError)
35
+ end
36
+ end
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: 16.8.9
4
+ version: 16.9.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-10 00:00:00.000000000 Z
11
+ date: 2021-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-config
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 16.8.9
19
+ version: 16.9.29
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: 16.8.9
26
+ version: 16.9.29
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: chef-utils
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 16.8.9
33
+ version: 16.9.29
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 16.8.9
40
+ version: 16.9.29
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: train-core
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -328,14 +328,14 @@ dependencies:
328
328
  requirements:
329
329
  - - '='
330
330
  - !ruby/object:Gem::Version
331
- version: 1.1.0.rc1
331
+ version: 1.1.0.rc2
332
332
  type: :runtime
333
333
  prerelease: false
334
334
  version_requirements: !ruby/object:Gem::Requirement
335
335
  requirements:
336
336
  - - '='
337
337
  - !ruby/object:Gem::Version
338
- version: 1.1.0.rc1
338
+ version: 1.1.0.rc2
339
339
  - !ruby/object:Gem::Dependency
340
340
  name: highline
341
341
  requirement: !ruby/object:Gem::Requirement
@@ -554,16 +554,22 @@ dependencies:
554
554
  name: uuidtools
555
555
  requirement: !ruby/object:Gem::Requirement
556
556
  requirements:
557
- - - "~>"
557
+ - - ">="
558
558
  - !ruby/object:Gem::Version
559
559
  version: 2.1.5
560
+ - - "<"
561
+ - !ruby/object:Gem::Version
562
+ version: '3.0'
560
563
  type: :runtime
561
564
  prerelease: false
562
565
  version_requirements: !ruby/object:Gem::Requirement
563
566
  requirements:
564
- - - "~>"
567
+ - - ">="
565
568
  - !ruby/object:Gem::Version
566
569
  version: 2.1.5
570
+ - - "<"
571
+ - !ruby/object:Gem::Version
572
+ version: '3.0'
567
573
  - !ruby/object:Gem::Dependency
568
574
  name: proxifier
569
575
  requirement: !ruby/object:Gem::Requirement
@@ -906,6 +912,7 @@ files:
906
912
  - lib/chef/knife/cookbook_upload.rb
907
913
  - lib/chef/knife/core/bootstrap_context.rb
908
914
  - lib/chef/knife/core/cookbook_scm_repo.rb
915
+ - lib/chef/knife/core/formatting_options.rb
909
916
  - lib/chef/knife/core/gem_glob_loader.rb
910
917
  - lib/chef/knife/core/generic_presenter.rb
911
918
  - lib/chef/knife/core/hashed_command_loader.rb
@@ -1774,6 +1781,10 @@ files:
1774
1781
  - spec/data/root_alias_cookbooks/simple/attributes.rb
1775
1782
  - spec/data/root_alias_cookbooks/simple/metadata.rb
1776
1783
  - spec/data/root_alias_cookbooks/simple/recipe.rb
1784
+ - spec/data/rubygems.org/latest_specs.4.8.gz
1785
+ - spec/data/rubygems.org/nonexistent_gem
1786
+ - spec/data/rubygems.org/sexp_processor
1787
+ - spec/data/rubygems.org/sexp_processor-4.15.1.gemspec.rz
1777
1788
  - spec/data/run_context/cookbooks/circular-dep1/attributes/default.rb
1778
1789
  - spec/data/run_context/cookbooks/circular-dep1/definitions/circular_dep1_res.rb
1779
1790
  - spec/data/run_context/cookbooks/circular-dep1/libraries/lib.rb
@@ -1855,6 +1866,8 @@ files:
1855
1866
  - spec/data/snap_package/get_conf_success.json
1856
1867
  - spec/data/snap_package/result_failure.json
1857
1868
  - spec/data/ssl/5e707473.0
1869
+ - spec/data/ssl/binary/chef-rspec-der.cert
1870
+ - spec/data/ssl/binary/chef-rspec-der.key
1858
1871
  - spec/data/ssl/chef-rspec.cert
1859
1872
  - spec/data/ssl/chef-rspec.key
1860
1873
  - spec/data/ssl/key.pem
@@ -1874,8 +1887,6 @@ files:
1874
1887
  - spec/data/trusted_certs/intermediate.pem
1875
1888
  - spec/data/trusted_certs/opscode.pem
1876
1889
  - spec/data/trusted_certs/root.pem
1877
- - spec/data/trusted_certs_empty/.gitkeep
1878
- - spec/data/trusted_certs_empty/README.md
1879
1890
  - spec/data/windows_certificates/base64_test.cer
1880
1891
  - spec/data/windows_certificates/othertest.cer
1881
1892
  - spec/data/windows_certificates/test.cer
@@ -2100,7 +2111,6 @@ files:
2100
2111
  - spec/integration/recipes/use_partial_spec.rb
2101
2112
  - spec/integration/solo/solo_spec.rb
2102
2113
  - spec/rcov.opts
2103
- - spec/scripts/ssl-serve.rb
2104
2114
  - spec/spec_helper.rb
2105
2115
  - spec/stress/win32/file_spec.rb
2106
2116
  - spec/stress/win32/memory_spec.rb
@@ -2293,6 +2303,7 @@ files:
2293
2303
  - spec/unit/knife/core/hashed_command_loader_spec.rb
2294
2304
  - spec/unit/knife/core/node_editor_spec.rb
2295
2305
  - spec/unit/knife/core/object_loader_spec.rb
2306
+ - spec/unit/knife/core/status_presenter_spec.rb
2296
2307
  - spec/unit/knife/core/subcommand_loader_spec.rb
2297
2308
  - spec/unit/knife/core/ui_spec.rb
2298
2309
  - spec/unit/knife/core/windows_bootstrap_context_spec.rb
@@ -2652,6 +2663,7 @@ files:
2652
2663
  - spec/unit/resource/systemd_unit_spec.rb
2653
2664
  - spec/unit/resource/template_spec.rb
2654
2665
  - spec/unit/resource/timezone_spec.rb
2666
+ - spec/unit/resource/user/windows_user_spec.rb
2655
2667
  - spec/unit/resource/user_spec.rb
2656
2668
  - spec/unit/resource/user_ulimit_spec.rb
2657
2669
  - spec/unit/resource/windows_ad_join_spec.rb
@@ -2744,7 +2756,13 @@ files:
2744
2756
  homepage: https://www.chef.io
2745
2757
  licenses:
2746
2758
  - Apache-2.0
2747
- metadata: {}
2759
+ metadata:
2760
+ bug_tracker_uri: https://github.com/chef/chef/issues
2761
+ changelog_uri: https://github.com/chef/chef/blob/master/CHANGELOG.md
2762
+ documentation_uri: https://docs.chef.io/
2763
+ homepage_uri: https://www.chef.io
2764
+ mailing_list_uri: https://discourse.chef.io/
2765
+ source_code_uri: https://github.com/chef/chef/
2748
2766
  post_install_message:
2749
2767
  rdoc_options: []
2750
2768
  require_paths:
File without changes
@@ -1 +0,0 @@
1
- A directory with no certs. Used for testing directories with no certs during bootstrap.
@@ -1,47 +0,0 @@
1
- # ssl-serve.rb
2
- # USAGE: ruby ssl-serve.rb
3
- #
4
- # ssl-serve is a script that serves a local directory over SSL.
5
- # You can use it to test various HTTP behaviors in chef, like chef-client's
6
- # `-j` and `-c` options and remote_file with https connections.
7
- #
8
- require "pp"
9
- require "openssl"
10
- require "webrick"
11
- require "webrick/https"
12
-
13
- $ssl = true
14
-
15
- CHEF_SPEC_DATA = File.expand_path("../data", __dir__)
16
- cert_text = File.read(File.expand_path("ssl/chef-rspec.cert", CHEF_SPEC_DATA))
17
- cert = OpenSSL::X509::Certificate.new(cert_text)
18
- key_text = File.read(File.expand_path("ssl/chef-rspec.key", CHEF_SPEC_DATA))
19
- key = OpenSSL::PKey::RSA.new(key_text)
20
-
21
- server_opts = {}
22
- if $ssl
23
- server_opts.merge!( { SSLEnable: true,
24
- SSLVerifyClient: OpenSSL::SSL::VERIFY_NONE,
25
- SSLCertificate: cert,
26
- SSLPrivateKey: key })
27
- end
28
-
29
- # 5 == debug, 3 == warning
30
- LOGGER = WEBrick::Log.new(STDOUT, 5)
31
- DEFAULT_OPTIONS = {
32
- server: "webrick",
33
- Port: 9000,
34
- Host: "localhost",
35
- environment: :none,
36
- Logger: LOGGER,
37
- DocumentRoot: File.expand_path("#{Dir.tmpdir}/chef-118-sampledata"),
38
- #:AccessLog => [] # Remove this option to enable the access log when debugging.
39
- }.freeze
40
-
41
- webrick_opts = DEFAULT_OPTIONS.merge(server_opts)
42
- pp webrick_opts: webrick_opts
43
-
44
- server = WEBrick::HTTPServer.new(webrick_opts)
45
- trap("INT") { server.shutdown }
46
-
47
- server.start