chef 17.9.42-universal-mingw32 → 17.10.0-universal-mingw32

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e96a2b9fbe28b79c84922dc0f6dbdb037bfdc85e9ced4f955104f9b15e4dcd1
4
- data.tar.gz: f5a0710ad660a1033a8a0c1fbd13467c6166fad4bf6fae683815a96cfafb339f
3
+ metadata.gz: c9cbd4092a3c15b8749b4baa6c30a11dc57b5969e6eac7803bbb0b030b3d15f9
4
+ data.tar.gz: ac1a6a0f09f08d3a9ef2c3a1a1c4268f9553811af29d306a23665571fd556f5d
5
5
  SHA512:
6
- metadata.gz: acd85d7110d82e25d39034ff407cea5175531f2d0bc0f93805efadbde2cc55f7f4f254dd521814aa154e184173281ee7b3519a498527c2631e9ceb9bec85eb50
7
- data.tar.gz: 3b7c7e92c217150aa5086b76697e3aced9ba378b627cb1ee516510e10c39f3679ab7493d25b63a6dc24c752ea1c22d2c5acd52cb5058d57b8c25b32b81ca4fd6
6
+ metadata.gz: 357aebb203e009d56da145000c700f5d021389053a4b44d1b52c553e4f191a194025ef76db35424ff48e29d84358e16247d48074ebe5ca50c6bfb72ff244d319
7
+ data.tar.gz: 8b7d0984dba48fe315ca239c98b22baa2f3f153dbb852ec03045e19eed16254d4d35ebbd8f1ad3782cdbcd72242c3c171fe71be07c2b68a5fcb3f655403489de
@@ -14,7 +14,8 @@ gemspec.add_dependency "win32-service", ">= 2.1.5", "< 3.0"
14
14
  gemspec.add_dependency "wmi-lite", "~> 1.0"
15
15
  gemspec.add_dependency "win32-taskscheduler", "~> 2.0"
16
16
  gemspec.add_dependency "iso8601", ">= 0.12.1", "< 0.14" # validate 0.14 when it comes out
17
- gemspec.add_dependency "win32-certstore", "~> 0.6.2" # 0.5+ required for specifying user vs. system store
17
+ gemspec.add_dependency "win32-certstore", "~> 0.6.2"
18
+ gemspec.add_dependency "chef-powershell", "~> 1.0.12" # 0.5+ required for specifying user vs. system store
18
19
  gemspec.extensions << "ext/win32-eventlog/Rakefile"
19
20
  gemspec.files += Dir.glob("{distro,ext}/**/*")
20
21
 
data/chef.gemspec CHANGED
@@ -42,7 +42,7 @@ Gem::Specification.new do |s|
42
42
  s.add_dependency "ffi-yajl", "~> 2.2"
43
43
  s.add_dependency "net-sftp", ">= 2.1.2", "< 4.0" # remote_file resource
44
44
  s.add_dependency "erubis", "~> 2.7" # template resource / cookbook syntax check
45
- s.add_dependency "diff-lcs", ">= 1.2.4", "< 1.4.0" # 1.4 breaks output. Used in lib/chef/util/diff
45
+ s.add_dependency "diff-lcs", ">= 1.2.4", "!= 1.4.0", "< 1.6.0" # 1.4 breaks output. Used in lib/chef/util/diff
46
46
  s.add_dependency "ffi-libarchive", "~> 1.0", ">= 1.0.3" # archive_file resource
47
47
  s.add_dependency "chef-zero", ">= 14.0.11"
48
48
  s.add_dependency "chef-vault" # chef-vault resources and helpers
@@ -196,7 +196,7 @@ class Chef
196
196
  end
197
197
 
198
198
  def reregister
199
- reregistered_self = http_api.put("clients/#{name}", { name: name, admin: admin, validator: validator, private_key: true })
199
+ reregistered_self = http_api.put("clients/#{name}", name: name, admin: admin, validator: validator, private_key: true )
200
200
  if reregistered_self.respond_to?(:[])
201
201
  private_key(reregistered_self["private_key"])
202
202
  else
@@ -27,7 +27,7 @@ class Chef
27
27
 
28
28
  # Controls what is done with the resulting report after the Chef InSpec run.
29
29
  # Accepts a single string value or an array of multiple values.
30
- # Accepted values: 'chef-server-automate', 'chef-automate', 'json-file', 'audit-enforcer', 'cli'
30
+ # Accepted values: 'chef-server-automate', 'chef-automate', 'json-file', 'audit-enforcer', 'compliance-enforcer', 'cli'
31
31
  "reporter" => nil,
32
32
 
33
33
  # Controls if Chef InSpec profiles should be fetched from Chef Automate or Chef Infra Server
@@ -1,7 +1,7 @@
1
1
  class Chef
2
2
  module Compliance
3
3
  module Reporter
4
- class AuditEnforcer
4
+ class ComplianceEnforcer
5
5
  class ControlFailure < StandardError; end
6
6
 
7
7
  def send_report(report)
@@ -7,7 +7,7 @@ class Chef
7
7
  class Runner < EventDispatch::Base
8
8
  extend Forwardable
9
9
 
10
- SUPPORTED_REPORTERS = %w{chef-automate chef-server-automate json-file audit-enforcer cli}.freeze
10
+ SUPPORTED_REPORTERS = %w{chef-automate chef-server-automate json-file audit-enforcer compliance-enforcer cli}.freeze
11
11
  SUPPORTED_FETCHERS = %w{chef-automate chef-server}.freeze
12
12
 
13
13
  attr_accessor :run_id
@@ -300,7 +300,7 @@ class Chef
300
300
  require_relative "reporter/json_file"
301
301
  path = node.dig("audit", "json_file", "location")
302
302
  Chef::Compliance::Reporter::JsonFile.new(file: path)
303
- when "audit-enforcer"
303
+ when "audit-enforcer", "compliance-enforcer"
304
304
  require_relative "reporter/compliance_enforcer"
305
305
  Chef::Compliance::Reporter::ComplianceEnforcer.new
306
306
  when "cli"
@@ -248,8 +248,7 @@ class Chef
248
248
  end
249
249
 
250
250
  def api_service
251
- @api_service ||= Chef::ServerAPI.new(config[:chef_server_url],
252
- { version_class: Chef::CookbookManifestVersions })
251
+ @api_service ||= Chef::ServerAPI.new(config[:chef_server_url], version_class: Chef::CookbookManifestVersions )
253
252
  end
254
253
 
255
254
  def config
@@ -507,7 +507,7 @@ class Chef
507
507
  # @api private
508
508
  def api_service
509
509
  @api_service ||= Chef::ServerAPI.new(config[:chef_server_url],
510
- { version_class: Chef::CookbookManifestVersions })
510
+ version_class: Chef::CookbookManifestVersions)
511
511
  end
512
512
 
513
513
  # @api private
@@ -214,7 +214,7 @@ class Chef
214
214
  def install(gem_dependency, options = {})
215
215
  with_gem_sources(*options.delete(:sources)) do
216
216
  with_correct_verbosity do
217
- dependency_installer(options).install(gem_dependency)
217
+ dependency_installer(**options).install(gem_dependency)
218
218
  end
219
219
  end
220
220
  end
@@ -228,7 +228,7 @@ class Chef
228
228
  def uninstall(gem_name, gem_version = nil, opts = {})
229
229
  gem_version ? opts[:version] = gem_version : opts[:all] = true
230
230
  with_correct_verbosity do
231
- uninstaller(gem_name, opts).uninstall
231
+ uninstaller(gem_name, **opts).uninstall
232
232
  end
233
233
  end
234
234
 
@@ -240,12 +240,12 @@ class Chef
240
240
  yield
241
241
  end
242
242
 
243
- def dependency_installer(opts = {})
244
- Gem::DependencyInstaller.new(opts)
243
+ def dependency_installer(**opts)
244
+ Gem::DependencyInstaller.new(**opts)
245
245
  end
246
246
 
247
- def uninstaller(gem_name, opts = {})
248
- Gem::Uninstaller.new(gem_name, DEFAULT_UNINSTALLER_OPTS.merge(opts))
247
+ def uninstaller(gem_name, **opts)
248
+ Gem::Uninstaller.new(gem_name, **DEFAULT_UNINSTALLER_OPTS.merge(opts))
249
249
  end
250
250
 
251
251
  private
@@ -178,7 +178,20 @@ class Chef
178
178
  #
179
179
  # @api private
180
180
  def combine_args(provides, version, arch)
181
- provides = provides.dup
181
+ provides = provides.to_s.strip
182
+ version = if !version.nil? && !version.empty?
183
+ version.to_s.strip
184
+ end
185
+ arch = if !arch.nil? && !arch.empty?
186
+ arch.to_s.strip
187
+ end
188
+ if version =~ /^[><=]/
189
+ if arch
190
+ return { "provides" => "#{provides}.#{arch} #{version}" }
191
+ else
192
+ return { "provides" => "#{provides} #{version}" }
193
+ end
194
+ end
182
195
  maybe_arch = provides.rpartition(".").last
183
196
  if is_arch?(maybe_arch)
184
197
  arch = maybe_arch
@@ -183,7 +183,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
183
183
  end
184
184
 
185
185
  converge_by("create service #{new_resource.service_name}") do
186
- Win32::Service.new(windows_service_config)
186
+ Win32::Service.new(**windows_service_config)
187
187
  end
188
188
 
189
189
  converge_delayed_start
@@ -209,7 +209,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
209
209
  converge_if_changed :service_type, :startup_type, :error_control,
210
210
  :binary_path_name, :load_order_group, :dependencies,
211
211
  :run_as_user, :display_name, :description do
212
- Win32::Service.configure(windows_service_config(:configure))
212
+ Win32::Service.configure(**windows_service_config(:configure))
213
213
  end
214
214
 
215
215
  converge_delayed_start
@@ -268,7 +268,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
268
268
  password: new_resource.run_as_password,
269
269
  }.reject { |k, v| v.nil? || v.length == 0 }
270
270
 
271
- Win32::Service.configure(new_config)
271
+ Win32::Service.configure(**new_config)
272
272
  logger.info "#{new_resource} configured."
273
273
 
274
274
  grant_service_logon(new_resource.run_as_user) if new_resource.run_as_user != "localsystem"
@@ -395,7 +395,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
395
395
  config[:service_name] = new_resource.service_name
396
396
  config[:delayed_start] = new_resource.delayed_start ? 1 : 0
397
397
 
398
- Win32::Service.configure(config)
398
+ Win32::Service.configure(**config)
399
399
  end
400
400
  end
401
401
 
@@ -78,11 +78,11 @@ class Chef
78
78
  end
79
79
 
80
80
  def create_user
81
- @net_user.add(set_options)
81
+ @net_user.add(**set_options)
82
82
  end
83
83
 
84
84
  def manage_user
85
- @net_user.update(set_options)
85
+ @net_user.update(**set_options)
86
86
  end
87
87
 
88
88
  def remove_user
@@ -20,6 +20,12 @@
20
20
 
21
21
  require_relative "../resource"
22
22
  require "fileutils" unless defined?(FileUtils)
23
+ begin
24
+ # ffi-libarchive must be eager loaded see: https://github.com/chef/chef/issues/12228
25
+ require "ffi-libarchive" unless defined?(Archive::Reader)
26
+ rescue LoadError
27
+ STDERR.puts "ffi-libarchive could not be loaded, libarchive is probably not installed on system, archive_file will not be available"
28
+ end
23
29
 
24
30
  class Chef
25
31
  class Resource
@@ -92,8 +98,6 @@ class Chef
92
98
 
93
99
  action :extract, description: "Extract and archive file." do
94
100
 
95
- require_libarchive
96
-
97
101
  unless ::File.exist?(new_resource.path)
98
102
  raise Errno::ENOENT, "No archive found at #{new_resource.path}! Cannot continue."
99
103
  end
@@ -131,10 +135,6 @@ class Chef
131
135
  end
132
136
 
133
137
  action_class do
134
- def require_libarchive
135
- require "ffi-libarchive"
136
- end
137
-
138
138
  def define_resource_requirements
139
139
  if new_resource.mode.is_a?(Integer)
140
140
  Chef.deprecated(:archive_file_integer_file_mode, "The mode property should be passed to archive_file resources as a String and not an Integer to ensure the value is properly interpreted.")
data/lib/chef/resource.rb CHANGED
@@ -341,6 +341,7 @@ class Chef
341
341
  def subscribes(action, resources, timing = :delayed)
342
342
  resources = [resources].flatten
343
343
  resources.each do |resource|
344
+ validate_resource_spec!(resource)
344
345
  if resource.is_a?(String)
345
346
  resource = UnresolvedSubscribes.new(resource, run_context)
346
347
  end
data/lib/chef/version.rb CHANGED
@@ -23,7 +23,7 @@ require_relative "version_string"
23
23
 
24
24
  class Chef
25
25
  CHEF_ROOT = File.expand_path("..", __dir__)
26
- VERSION = Chef::VersionString.new("17.9.42")
26
+ VERSION = Chef::VersionString.new("17.10.0")
27
27
  end
28
28
 
29
29
  #
@@ -18,8 +18,9 @@
18
18
  require "spec_helper"
19
19
  require "tmpdir"
20
20
 
21
- # Exclude this test on platforms where ffi-libarchive loading is broken
22
- describe Chef::Resource::ArchiveFile, :libarchive_loading_broken do
21
+ # AIX is broken, see https://github.com/chef/omnibus-software/issues/1566
22
+ # Windows tests are disbled since we'd need libarchive on windows testers in buildkite for PRs
23
+ describe Chef::Resource::ArchiveFile, :not_supported_on_aix, :not_supported_on_windows do
23
24
  include RecipeDSLHelper
24
25
 
25
26
  let(:tmp_path) { Dir.mktmpdir }
@@ -709,6 +709,21 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
709
709
  action :install
710
710
  end.should_not_be_updated
711
711
  end
712
+
713
+ it "works with constraints in the version property" do
714
+ flush_cache
715
+ dnf_package "chef_rpm" do
716
+ version ">= 1.10"
717
+ options default_options
718
+ action :install
719
+ end.should_be_updated
720
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
721
+ dnf_package "chef_rpm" do
722
+ version ">= 1.10"
723
+ options default_options
724
+ action :install
725
+ end.should_not_be_updated
726
+ end
712
727
  end
713
728
 
714
729
  context "with source arguments" do
@@ -754,6 +754,21 @@ describe Chef::Resource::YumPackage, :requires_root, external: exclude_test do
754
754
  action :install
755
755
  end.should_not_be_updated
756
756
  end
757
+
758
+ it "works with constraints in the version property" do
759
+ flush_cache
760
+ yum_package "chef_rpm" do
761
+ version ">= 1.10"
762
+ options default_options
763
+ action :install
764
+ end.should_be_updated
765
+ expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
766
+ yum_package "chef_rpm" do
767
+ version ">= 1.10"
768
+ options default_options
769
+ action :install
770
+ end.should_not_be_updated
771
+ end
757
772
  end
758
773
 
759
774
  context "with source arguments" do
data/spec/spec_helper.rb CHANGED
@@ -187,8 +187,6 @@ RSpec.configure do |config|
187
187
  config.filter_run_excluding not_rhel7: true if rhel7?
188
188
  config.filter_run_excluding not_intel_64bit: true if intel_64bit?
189
189
 
190
- config.filter_run_excluding libarchive_loading_broken: true if aix? || amazon_linux? || rhel7?
191
-
192
190
  # these let us use chef: ">= 13" or ruby: "~> 2.0.0" or any other Gem::Dependency-style constraint
193
191
  config.filter_run_excluding chef: DependencyProc.with(Chef::VERSION)
194
192
  config.filter_run_excluding ruby: DependencyProc.with(RUBY_VERSION)
@@ -1,8 +1,8 @@
1
1
  require "spec_helper"
2
2
  require "chef/compliance/reporter/compliance_enforcer"
3
3
 
4
- describe Chef::Compliance::Reporter::AuditEnforcer do
5
- let(:reporter) { Chef::Compliance::Reporter::AuditEnforcer.new }
4
+ describe Chef::Compliance::Reporter::ComplianceEnforcer do
5
+ let(:reporter) { Chef::Compliance::Reporter::ComplianceEnforcer.new }
6
6
 
7
7
  it "does not raise error for a successful InSpec report" do
8
8
  report = {
@@ -44,6 +44,6 @@ describe Chef::Compliance::Reporter::AuditEnforcer do
44
44
 
45
45
  expect {
46
46
  reporter.send_report(report)
47
- }.to raise_error(Chef::Compliance::Reporter::AuditEnforcer::ControlFailure, "Audit c2 has failed. Aborting chef-client run.")
47
+ }.to raise_error(Chef::Compliance::Reporter::ComplianceEnforcer::ControlFailure, "Audit c2 has failed. Aborting chef-client run.")
48
48
  end
49
49
  end
@@ -29,8 +29,7 @@ rescue LoadError
29
29
  end
30
30
  end
31
31
 
32
- # Exclude this test on platforms where ffi-libarchive loading is broken
33
- describe Chef::Resource::ArchiveFile, :libarchive_loading_broken do
32
+ describe Chef::Resource::ArchiveFile, :not_supported_on_aix do
34
33
  let(:node) { Chef::Node.new }
35
34
  let(:events) { Chef::EventDispatch::Dispatcher.new }
36
35
  let(:run_context) { Chef::RunContext.new(node, {}, events) }
@@ -300,27 +300,35 @@ describe Chef::Resource do
300
300
  end
301
301
 
302
302
  describe "subscribes" do
303
+ context "with syntax error in resources parameter" do
304
+ it "raises an exception immediately" do
305
+ expect do
306
+ resource.subscribes(:run, "typo[missing-closing-bracket")
307
+ end.to raise_error(Chef::Exceptions::InvalidResourceSpecification)
308
+ end
309
+ end
310
+
303
311
  it "should make resources appear in the actions hash of subscribed nodes" do
304
- run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee")
312
+ run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee", run_context)
305
313
  zr = run_context.resource_collection.find(zen_master: "coffee")
306
314
  resource.subscribes :reload, zr
307
315
  expect(zr.delayed_notifications.detect { |e| e.resource.name == "funk" && e.action == :reload }).not_to be_nil
308
316
  end
309
317
 
310
318
  it "should make resources appear in the actions hash of subscribed nodes" do
311
- run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee")
319
+ run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee", run_context)
312
320
  zr = run_context.resource_collection.find(zen_master: "coffee")
313
321
  resource.subscribes :reload, zr
314
322
  expect(zr.delayed_notifications.detect { |e| e.resource.name == resource.name && e.action == :reload }).not_to be_nil
315
323
 
316
- run_context.resource_collection << Chef::Resource::ZenMaster.new("bean")
324
+ run_context.resource_collection << Chef::Resource::ZenMaster.new("bean", run_context)
317
325
  zrb = run_context.resource_collection.find(zen_master: "bean")
318
326
  zrb.subscribes :reload, zr
319
327
  expect(zr.delayed_notifications.detect { |e| e.resource.name == resource.name && e.action == :reload }).not_to be_nil
320
328
  end
321
329
 
322
330
  it "should make subscribed resources be capable of acting immediately" do
323
- run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee")
331
+ run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee", run_context)
324
332
  zr = run_context.resource_collection.find(zen_master: "coffee")
325
333
  resource.subscribes :reload, zr, :immediately
326
334
  expect(zr.immediate_notifications.detect { |e| e.resource.name == resource.name && e.action == :reload }).not_to be_nil
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: 17.9.42
4
+ version: 17.10.0
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: 2022-01-28 00:00:00.000000000 Z
11
+ date: 2022-03-17 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: 17.9.42
19
+ version: 17.10.0
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: 17.9.42
26
+ version: 17.10.0
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: 17.9.42
33
+ version: 17.10.0
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: 17.9.42
40
+ version: 17.10.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: train-core
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -289,9 +289,12 @@ dependencies:
289
289
  - - ">="
290
290
  - !ruby/object:Gem::Version
291
291
  version: 1.2.4
292
- - - "<"
292
+ - - "!="
293
293
  - !ruby/object:Gem::Version
294
294
  version: 1.4.0
295
+ - - "<"
296
+ - !ruby/object:Gem::Version
297
+ version: 1.6.0
295
298
  type: :runtime
296
299
  prerelease: false
297
300
  version_requirements: !ruby/object:Gem::Requirement
@@ -299,9 +302,12 @@ dependencies:
299
302
  - - ">="
300
303
  - !ruby/object:Gem::Version
301
304
  version: 1.2.4
302
- - - "<"
305
+ - - "!="
303
306
  - !ruby/object:Gem::Version
304
307
  version: 1.4.0
308
+ - - "<"
309
+ - !ruby/object:Gem::Version
310
+ version: 1.6.0
305
311
  - !ruby/object:Gem::Dependency
306
312
  name: ffi-libarchive
307
313
  requirement: !ruby/object:Gem::Requirement
@@ -662,6 +668,20 @@ dependencies:
662
668
  - - "~>"
663
669
  - !ruby/object:Gem::Version
664
670
  version: 0.6.2
671
+ - !ruby/object:Gem::Dependency
672
+ name: chef-powershell
673
+ requirement: !ruby/object:Gem::Requirement
674
+ requirements:
675
+ - - "~>"
676
+ - !ruby/object:Gem::Version
677
+ version: 1.0.12
678
+ type: :runtime
679
+ prerelease: false
680
+ version_requirements: !ruby/object:Gem::Requirement
681
+ requirements:
682
+ - - "~>"
683
+ - !ruby/object:Gem::Version
684
+ version: 1.0.12
665
685
  description: A systems integration framework, built to bring the benefits of configuration
666
686
  management to your entire infrastructure.
667
687
  email: adam@chef.io