chef 17.9.18-universal-mingw32 → 17.9.52-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -3
- data/README.md +1 -1
- data/lib/chef/application/exit_code.rb +7 -21
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/base_file.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/file_system_entry.rb +1 -1
- data/lib/chef/compliance/default_attributes.rb +1 -1
- data/lib/chef/compliance/input_collection.rb +1 -1
- data/lib/chef/compliance/reporter/compliance_enforcer.rb +1 -1
- data/lib/chef/compliance/runner.rb +2 -2
- data/lib/chef/compliance/waiver_collection.rb +1 -1
- data/lib/chef/cookbook/syntax_check.rb +1 -1
- data/lib/chef/cookbook_uploader.rb +1 -1
- data/lib/chef/cookbook_version.rb +1 -1
- data/lib/chef/provider/ifconfig.rb +1 -1
- data/lib/chef/provider/package.rb +1 -1
- data/lib/chef/provider/user/mac.rb +3 -3
- data/lib/chef/resource/archive_file.rb +6 -6
- data/lib/chef/resource/habitat/habitat_sup.rb +1 -1
- data/lib/chef/resource/habitat/habitat_sup_windows.rb +1 -1
- data/lib/chef/resource/homebrew_tap.rb +1 -1
- data/lib/chef/resource/inspec_waiver_file_entry.rb +1 -1
- data/lib/chef/resource/launchd.rb +2 -2
- data/lib/chef/resource/lwrp_base.rb +1 -1
- data/lib/chef/resource/remote_file.rb +1 -1
- data/lib/chef/resource.rb +3 -2
- data/lib/chef/resource_reporter.rb +1 -1
- data/lib/chef/run_lock.rb +1 -1
- data/lib/chef/secret_fetcher/azure_key_vault.rb +2 -2
- data/lib/chef/util/dsc/configuration_generator.rb +1 -1
- data/lib/chef/version.rb +1 -1
- data/spec/functional/resource/archive_file_spec.rb +3 -2
- data/spec/functional/resource/cookbook_file_spec.rb +1 -1
- data/spec/functional/resource/dsc_script_spec.rb +2 -2
- data/spec/functional/resource/template_spec.rb +1 -1
- data/spec/integration/client/client_spec.rb +1 -1
- data/spec/spec_helper.rb +3 -5
- data/spec/support/platform_helpers.rb +1 -1
- data/spec/support/ruby_installer.rb +1 -1
- data/spec/support/shared/functional/file_resource.rb +2 -2
- data/spec/support/shared/functional/http.rb +9 -9
- data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +1 -1
- data/spec/unit/compliance/reporter/compliance_enforcer_spec.rb +3 -3
- data/spec/unit/dsl/registry_helper_spec.rb +6 -6
- data/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb +1 -1
- data/spec/unit/lwrp_spec.rb +2 -2
- data/spec/unit/provider/dsc_script_spec.rb +8 -8
- data/spec/unit/provider/group/usermod_spec.rb +2 -2
- data/spec/unit/provider/ifconfig/aix_spec.rb +14 -14
- data/spec/unit/provider/ifconfig/debian_spec.rb +1 -1
- data/spec/unit/provider/ifconfig/redhat_spec.rb +1 -1
- data/spec/unit/provider/ifconfig_spec.rb +3 -3
- data/spec/unit/provider/remote_file/cache_control_data_spec.rb +3 -3
- data/spec/unit/provider/service/gentoo_service_spec.rb +2 -2
- data/spec/unit/provider/service/upstart_service_spec.rb +3 -3
- data/spec/unit/provider/user/solaris_spec.rb +1 -1
- data/spec/unit/resource/archive_file_spec.rb +1 -2
- data/spec/unit/resource/conditional_spec.rb +4 -4
- data/spec/unit/resource_spec.rb +14 -6
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef4f4acb5e1adc0f97c4eaf653095911e5206dfb761b740b710cbaf78358c0dc
|
4
|
+
data.tar.gz: 38ad6e54f2c3671b389ca4eafa897c3ccea722774aca326aaf65b3dbc8164e28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d48d9f5d33b520dd732ba953e0d1c3624412f34e00585085fbe6c81d4d19664a240d2d716b3362a2a310b1754a3a50c4378c83c43abe33af78c62afd045dcf90
|
7
|
+
data.tar.gz: 94d27dfbc0507da0f0cf9df56efc0f14039e33fd3c21d410667ed54f0438333fdac5655b789b9972afdcb57ae6bb14fbf5bb0e15dbd35111efce3dafe4215fb5
|
data/Gemfile
CHANGED
@@ -2,7 +2,7 @@ source "https://rubygems.org"
|
|
2
2
|
|
3
3
|
gem "chef", path: "."
|
4
4
|
|
5
|
-
gem "ohai", git: "https://github.com/chef/ohai.git", branch: "
|
5
|
+
gem "ohai", git: "https://github.com/chef/ohai.git", branch: "17-stable"
|
6
6
|
|
7
7
|
gem "chef-utils", path: File.expand_path("chef-utils", __dir__) if File.exist?(File.expand_path("chef-utils", __dir__))
|
8
8
|
gem "chef-config", path: File.expand_path("chef-config", __dir__) if File.exist?(File.expand_path("chef-config", __dir__))
|
@@ -15,7 +15,7 @@ else
|
|
15
15
|
gem "chef-bin" # rubocop:disable Bundler/DuplicatedGem
|
16
16
|
end
|
17
17
|
|
18
|
-
gem "cheffish", "
|
18
|
+
gem "cheffish", "~> 17.0"
|
19
19
|
|
20
20
|
group(:omnibus_package) do
|
21
21
|
gem "appbundler"
|
@@ -29,7 +29,7 @@ group(:omnibus_package, :pry) do
|
|
29
29
|
# some work is ongoing? https://github.com/deivid-rodriguez/pry-byebug/issues/343
|
30
30
|
gem "pry", "= 0.13.0"
|
31
31
|
# byebug does not install on freebsd on ruby 3.0
|
32
|
-
gem "pry-byebug" unless RUBY_PLATFORM
|
32
|
+
gem "pry-byebug" unless RUBY_PLATFORM.match?(/freebsd/i)
|
33
33
|
gem "pry-stack_explorer"
|
34
34
|
end
|
35
35
|
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Chef Infra
|
2
2
|
[![Code Climate](https://codeclimate.com/github/chef/chef.svg)](https://codeclimate.com/github/chef/chef)
|
3
|
-
[![Build Status](https://badge.buildkite.com/c82093430ceec7d27af05febb9dcafe3aa331fff9d74c0ab9d.svg?branch=
|
3
|
+
[![Build Status](https://badge.buildkite.com/c82093430ceec7d27af05febb9dcafe3aa331fff9d74c0ab9d.svg?branch=chef-17)](https://buildkite.com/chef-oss/chef-chef-chef-17-verify)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/chef.svg)](https://badge.fury.io/rb/chef)
|
5
5
|
[![](https://img.shields.io/badge/Release%20Policy-Cadence%20Release-brightgreen.svg)](https://github.com/chef/chef/blob/master/docs/dev/design_documents/client_release_cadence.md)
|
6
6
|
|
@@ -90,45 +90,31 @@ class Chef
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def reboot_scheduled?(exception)
|
93
|
-
resolve_exception_array(exception).any?
|
94
|
-
e.is_a? Chef::Exceptions::Reboot
|
95
|
-
end
|
93
|
+
resolve_exception_array(exception).any?(Chef::Exceptions::Reboot)
|
96
94
|
end
|
97
95
|
|
98
96
|
def reboot_needed?(exception)
|
99
|
-
resolve_exception_array(exception).any?
|
100
|
-
e.is_a? Chef::Exceptions::RebootPending
|
101
|
-
end
|
97
|
+
resolve_exception_array(exception).any?(Chef::Exceptions::RebootPending)
|
102
98
|
end
|
103
99
|
|
104
100
|
def reboot_failed?(exception)
|
105
|
-
resolve_exception_array(exception).any?
|
106
|
-
e.is_a? Chef::Exceptions::RebootFailed
|
107
|
-
end
|
101
|
+
resolve_exception_array(exception).any?(Chef::Exceptions::RebootFailed)
|
108
102
|
end
|
109
103
|
|
110
104
|
def configuration_failure?(exception)
|
111
|
-
resolve_exception_array(exception).any?
|
112
|
-
e.is_a? Chef::Exceptions::ConfigurationError
|
113
|
-
end
|
105
|
+
resolve_exception_array(exception).any?(Chef::Exceptions::ConfigurationError)
|
114
106
|
end
|
115
107
|
|
116
108
|
def client_upgraded?(exception)
|
117
|
-
resolve_exception_array(exception).any?
|
118
|
-
e.is_a? Chef::Exceptions::ClientUpgraded
|
119
|
-
end
|
109
|
+
resolve_exception_array(exception).any?(Chef::Exceptions::ClientUpgraded)
|
120
110
|
end
|
121
111
|
|
122
112
|
def sigint_received?(exception)
|
123
|
-
resolve_exception_array(exception).any?
|
124
|
-
e.is_a? Chef::Exceptions::SigInt
|
125
|
-
end
|
113
|
+
resolve_exception_array(exception).any?(Chef::Exceptions::SigInt)
|
126
114
|
end
|
127
115
|
|
128
116
|
def sigterm_received?(exception)
|
129
|
-
resolve_exception_array(exception).any?
|
130
|
-
e.is_a? Chef::Exceptions::SigTerm
|
131
|
-
end
|
117
|
+
resolve_exception_array(exception).any?(Chef::Exceptions::SigTerm)
|
132
118
|
end
|
133
119
|
|
134
120
|
def resolve_exception_array(exception)
|
@@ -38,7 +38,7 @@ class Chef
|
|
38
38
|
|
39
39
|
def read
|
40
40
|
tmpfile = rest.streaming_request(file[:url])
|
41
|
-
File.
|
41
|
+
File.binread(tmpfile)
|
42
42
|
rescue Timeout::Error => e
|
43
43
|
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:read, self, e, "Timeout reading #{file[:url]}: #{e}")
|
44
44
|
rescue Net::HTTPClientException => e
|
@@ -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
|
@@ -57,7 +57,7 @@ class Chef
|
|
57
57
|
# @return [Array<Input>] inspec inputs which are enabled in a form suitable to pass to inspec
|
58
58
|
#
|
59
59
|
def inspec_data
|
60
|
-
select(&:enabled?).each_with_object({}) { |input, hash| hash.merge(input.inspec_data) }
|
60
|
+
select(&:enabled?).each_with_object({}) { |input, hash| hash.merge!(input.inspec_data) }
|
61
61
|
end
|
62
62
|
|
63
63
|
# DSL method to enable input files. This matches on the filename of the input file.
|
@@ -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"
|
@@ -57,7 +57,7 @@ class Chef
|
|
57
57
|
# @return [Array<Waiver>] inspec waivers which are enabled in a form suitable to pass to inspec
|
58
58
|
#
|
59
59
|
def inspec_data
|
60
|
-
select(&:enabled?).each_with_object({}) { |waiver, hash| hash.merge(waiver.inspec_data) }
|
60
|
+
select(&:enabled?).each_with_object({}) { |waiver, hash| hash.merge!(waiver.inspec_data) }
|
61
61
|
end
|
62
62
|
|
63
63
|
# DSL method to enable waiver files. This matches on the filename of the waiver file.
|
@@ -113,7 +113,7 @@ class Chef
|
|
113
113
|
end
|
114
114
|
|
115
115
|
def remove_uninteresting_ruby_files(file_list)
|
116
|
-
file_list.
|
116
|
+
file_list.grep_v(%r{#{Regexp.quote(cookbook_path)}/(files|templates)/})
|
117
117
|
end
|
118
118
|
|
119
119
|
def ruby_files
|
@@ -119,7 +119,7 @@ class Chef
|
|
119
119
|
# but we need the base64 encoding for the content-md5
|
120
120
|
# header
|
121
121
|
checksum64 = Base64.encode64([checksum].pack("H*")).strip
|
122
|
-
file_contents = File.
|
122
|
+
file_contents = File.binread(file)
|
123
123
|
|
124
124
|
# Custom headers. 'content-type' disables JSON serialization of the request body.
|
125
125
|
headers = { "content-type" => "application/x-binary", "content-md5" => checksum64, "accept" => "application/json" }
|
@@ -598,7 +598,7 @@ class Chef
|
|
598
598
|
filename = record[:name]
|
599
599
|
base_dup_name = File.join(File.dirname(filename), File.basename(filename, File.extname(filename)))
|
600
600
|
yml_files.each do |other|
|
601
|
-
if
|
601
|
+
if /#{(File.extname(filename) == ".yml") ? "#{base_dup_name}.yaml" : "#{base_dup_name}.yml"}$/.match?(other[:name])
|
602
602
|
raise Chef::Exceptions::AmbiguousYAMLFile.new("Cookbook #{name}@#{version} contains ambiguous files: #{filename} and #{other[:name]}. Please update the cookbook to remove the incorrect file.")
|
603
603
|
end
|
604
604
|
end
|
@@ -120,7 +120,7 @@ class Chef
|
|
120
120
|
@status = shell_out("ifconfig")
|
121
121
|
@status.stdout.each_line do |line|
|
122
122
|
addr_regex = /^((\w|-)+):?(\d*):?\ .+$/
|
123
|
-
if line
|
123
|
+
if line&.match?(addr_regex)
|
124
124
|
if line.match(addr_regex).nil?
|
125
125
|
@int_name = "nil"
|
126
126
|
elsif line.match(addr_regex)[3] == ""
|
@@ -339,7 +339,7 @@ class Chef
|
|
339
339
|
end
|
340
340
|
|
341
341
|
def locked?
|
342
|
-
user_plist[:auth_authority].any?
|
342
|
+
user_plist[:auth_authority].any?(";DisabledUser;")
|
343
343
|
rescue
|
344
344
|
false
|
345
345
|
end
|
@@ -411,7 +411,7 @@ class Chef
|
|
411
411
|
end
|
412
412
|
|
413
413
|
def secure_token_enabled?
|
414
|
-
user_plist[:auth_authority].any?
|
414
|
+
user_plist[:auth_authority].any?(";SecureToken;")
|
415
415
|
rescue
|
416
416
|
false
|
417
417
|
end
|
@@ -505,7 +505,7 @@ class Chef
|
|
505
505
|
end
|
506
506
|
|
507
507
|
def admin_user?
|
508
|
-
admin_group_plist[:group_members].any?
|
508
|
+
admin_group_plist[:group_members].any?(user_plist[:guid][0])
|
509
509
|
rescue
|
510
510
|
false
|
511
511
|
end
|
@@ -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.")
|
@@ -53,7 +53,7 @@ class Chef
|
|
53
53
|
action :tap, description: "Add a Homebrew tap." do
|
54
54
|
unless tapped?(new_resource.tap_name)
|
55
55
|
converge_by("tap #{new_resource.tap_name}") do
|
56
|
-
shell_out!("#{new_resource.homebrew_path} tap #{new_resource.
|
56
|
+
shell_out!("#{new_resource.homebrew_path} tap #{new_resource.tap_name} #{new_resource.url || ""}",
|
57
57
|
user: new_resource.owner,
|
58
58
|
env: { "HOME" => ::Dir.home(new_resource.owner), "USER" => new_resource.owner },
|
59
59
|
cwd: ::Dir.home(new_resource.owner))
|
@@ -135,7 +135,7 @@ class Chef
|
|
135
135
|
|
136
136
|
action_class do
|
137
137
|
def load_waiver_file_to_hash(file_name)
|
138
|
-
if
|
138
|
+
if %r{(/|C:\\).*(.yaml|.yml)}i.match?(file_name)
|
139
139
|
if ::File.exist?(file_name)
|
140
140
|
hash = ::YAML.load_file(file_name)
|
141
141
|
if hash == false || hash.nil? || hash == ""
|
@@ -84,7 +84,7 @@ class Chef
|
|
84
84
|
end
|
85
85
|
|
86
86
|
# Check to make sure that our array only has hashes
|
87
|
-
unless array.all?
|
87
|
+
unless array.all?(Hash)
|
88
88
|
error_msg = "start_calendar_interval must be a single hash or an array of hashes!"
|
89
89
|
raise Chef::Exceptions::ValidationFailed, error_msg
|
90
90
|
end
|
@@ -98,7 +98,7 @@ class Chef
|
|
98
98
|
raise Chef::Exceptions::ValidationFailed, error_msg
|
99
99
|
end
|
100
100
|
|
101
|
-
unless entry.values.all?
|
101
|
+
unless entry.values.all?(Integer)
|
102
102
|
failed_values = entry.values.reject { |val| val.is_a?(Integer) }.join(", ")
|
103
103
|
error_msg = "Invalid value(s) (#{failed_values}) for start_calendar_interval item. Values must be integers!"
|
104
104
|
raise Chef::Exceptions::ValidationFailed, error_msg
|
@@ -54,7 +54,7 @@ class Chef
|
|
54
54
|
resource_class.run_context = run_context
|
55
55
|
resource_class.class_from_file(filename)
|
56
56
|
|
57
|
-
if !resource_class.unified_mode && !deprecated_class(resource_class)
|
57
|
+
if !resource_class.unified_mode && !deprecated_class(resource_class) && cookbook_name.to_s != "chef_client_updater"
|
58
58
|
Chef.deprecated :unified_mode, "The #{resource_class.resource_name} resource in the #{cookbook_name} cookbook should declare `unified_mode true`", filename
|
59
59
|
end
|
60
60
|
|
@@ -138,7 +138,7 @@ class Chef
|
|
138
138
|
nil
|
139
139
|
elsif args[0].is_a?(Chef::DelayedEvaluator) && args.count == 1
|
140
140
|
args[0]
|
141
|
-
elsif args.any?
|
141
|
+
elsif args.any?(Chef::DelayedEvaluator) && args.count > 1
|
142
142
|
raise Exceptions::InvalidRemoteFileURI, "Only 1 source argument allowed when using a lazy evaluator"
|
143
143
|
else
|
144
144
|
Array(args).flatten
|
data/lib/chef/resource.rb
CHANGED
@@ -311,7 +311,7 @@ class Chef
|
|
311
311
|
# file '/foo.txt' do
|
312
312
|
# content 'hi'
|
313
313
|
# action :nothing
|
314
|
-
# subscribes :create,
|
314
|
+
# subscribes :create, bar
|
315
315
|
# end
|
316
316
|
# @example Multiple resources by string
|
317
317
|
# file '/foo.txt' do
|
@@ -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
|
@@ -1096,7 +1097,7 @@ class Chef
|
|
1096
1097
|
rescue NameError => e
|
1097
1098
|
# This can happen when attempting to load a provider in a platform-specific
|
1098
1099
|
# environment where we have not required the necessary files yet
|
1099
|
-
raise unless
|
1100
|
+
raise unless /uninitialized constant/.match?(e.message)
|
1100
1101
|
end
|
1101
1102
|
|
1102
1103
|
# Define a method to load up this resource's properties with the current
|
@@ -34,7 +34,7 @@ class Chef
|
|
34
34
|
as_hash["after"] = new_resource.state_for_resource_reporter
|
35
35
|
as_hash["before"] = current_resource ? current_resource.state_for_resource_reporter : {}
|
36
36
|
as_hash["duration"] = ( action_record.elapsed_time * 1000 ).to_i.to_s
|
37
|
-
as_hash["delta"] = new_resource.diff if new_resource.respond_to?(
|
37
|
+
as_hash["delta"] = new_resource.diff if new_resource.respond_to?(:diff)
|
38
38
|
as_hash["delta"] = "" if as_hash["delta"].nil?
|
39
39
|
|
40
40
|
# TODO: rename as "action"
|
data/lib/chef/run_lock.rb
CHANGED
@@ -144,7 +144,7 @@ class Chef
|
|
144
144
|
# If we support FD_CLOEXEC, then use it.
|
145
145
|
# NB: ruby-2.0.0-p195 sets FD_CLOEXEC by default, but not
|
146
146
|
# ruby-1.8.7/1.9.3
|
147
|
-
if Fcntl.const_defined?(
|
147
|
+
if Fcntl.const_defined?(:F_SETFD) && Fcntl.const_defined?(:FD_CLOEXEC)
|
148
148
|
runlock.fcntl(Fcntl::F_SETFD, runlock.fcntl(Fcntl::F_GETFD, 0) | Fcntl::FD_CLOEXEC)
|
149
149
|
end
|
150
150
|
# Flock will return 0 if it can acquire the lock otherwise it
|
@@ -59,7 +59,7 @@ class Chef
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def validate!
|
62
|
-
raise Chef::Exceptions::Secret::ConfigurationInvalid, "You may only specify one (these are mutually exclusive): :object_id, :client_id, or :mi_res_id" if [object_id, client_id, mi_res_id].
|
62
|
+
raise Chef::Exceptions::Secret::ConfigurationInvalid, "You may only specify one (these are mutually exclusive): :object_id, :client_id, or :mi_res_id" if [object_id, client_id, mi_res_id].count { |x| !x.nil? } > 1
|
63
63
|
end
|
64
64
|
|
65
65
|
private
|
@@ -123,7 +123,7 @@ class Chef
|
|
123
123
|
body["access_token"]
|
124
124
|
when Net::HTTPBadRequest
|
125
125
|
body = JSON.parse(response.body)
|
126
|
-
raise Chef::Exceptions::Secret::Azure::IdentityNotFound if
|
126
|
+
raise Chef::Exceptions::Secret::Azure::IdentityNotFound if /identity not found/i.match?(body["error_description"])
|
127
127
|
else
|
128
128
|
body = JSON.parse(response.body)
|
129
129
|
body["access_token"]
|
data/lib/chef/version.rb
CHANGED
@@ -18,8 +18,9 @@
|
|
18
18
|
require "spec_helper"
|
19
19
|
require "tmpdir"
|
20
20
|
|
21
|
-
#
|
22
|
-
|
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 }
|
@@ -25,7 +25,7 @@ describe Chef::Resource::CookbookFile do
|
|
25
25
|
let(:source) { "java.response" }
|
26
26
|
let(:cookbook_name) { "java" }
|
27
27
|
let(:expected_content) do
|
28
|
-
content = File.
|
28
|
+
content = File.binread(File.join(CHEF_SPEC_DATA, "cookbooks", "java", "files", "default", "java.response"))
|
29
29
|
content.force_encoding(Encoding::BINARY) if content.respond_to?(:force_encoding)
|
30
30
|
content
|
31
31
|
end
|
@@ -345,7 +345,7 @@ describe Chef::Resource::DscScript, :windows_powershell_dsc_only, :ruby64_only d
|
|
345
345
|
let(:config_param_section) { config_params }
|
346
346
|
let(:config_flags) { { "#{dsc_user_prefix_param_name}": (dsc_user_prefix).to_s, "#{dsc_user_suffix_param_name}": (dsc_user_suffix).to_s } }
|
347
347
|
it "does not directly contain the user name" do
|
348
|
-
configuration_script_content = ::File.
|
348
|
+
configuration_script_content = ::File.read(dsc_test_resource.command)
|
349
349
|
expect(configuration_script_content.include?(dsc_user)).to be(false)
|
350
350
|
end
|
351
351
|
it_behaves_like "a dsc_script with configuration data"
|
@@ -355,7 +355,7 @@ describe Chef::Resource::DscScript, :windows_powershell_dsc_only, :ruby64_only d
|
|
355
355
|
let(:dsc_user_code) { dsc_user_env_code }
|
356
356
|
|
357
357
|
it "does not directly contain the user name" do
|
358
|
-
configuration_script_content = ::File.
|
358
|
+
configuration_script_content = ::File.read(dsc_test_resource.command)
|
359
359
|
expect(configuration_script_content.include?(dsc_user)).to be(false)
|
360
360
|
end
|
361
361
|
it_behaves_like "a dsc_script with configuration data"
|
data/spec/spec_helper.rb
CHANGED
@@ -78,9 +78,9 @@ require "spec/support/recipe_dsl_helper"
|
|
78
78
|
# Excludes support/platforms by default
|
79
79
|
# Do not change the gsub.
|
80
80
|
Dir["spec/support/**/*.rb"]
|
81
|
-
.
|
82
|
-
.
|
83
|
-
.
|
81
|
+
.grep_v(%r{^spec/support/platforms})
|
82
|
+
.grep_v(%r{^spec/support/pedant})
|
83
|
+
.grep_v(%r{^spec/support/shared/integration/knife_support})
|
84
84
|
.map { |f| f.gsub(/.rb$/, "") }
|
85
85
|
.map { |f| f.gsub(%r{spec/}, "") }
|
86
86
|
.each { |f| require f }
|
@@ -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)
|
@@ -48,4 +48,4 @@ rescue LoadError
|
|
48
48
|
$stderr.puts "Failed to load ruby_installer. Assuming Ruby Installer is not being used."
|
49
49
|
end
|
50
50
|
|
51
|
-
add_libarchive_dll_directory if RUBY_PLATFORM
|
51
|
+
add_libarchive_dll_directory if RUBY_PLATFORM.match?(/mswin|mingw32|windows/)
|
@@ -157,7 +157,7 @@ shared_examples_for "a file with the wrong content" do
|
|
157
157
|
|
158
158
|
context "when running :create action" do
|
159
159
|
let(:provider) { resource.provider_for_action(:create) }
|
160
|
-
let(:reporter_messages) { provider.instance_variable_get(
|
160
|
+
let(:reporter_messages) { provider.instance_variable_get(:@converge_actions).actions[0][0] }
|
161
161
|
|
162
162
|
before do
|
163
163
|
provider.run_action
|
@@ -391,7 +391,7 @@ shared_examples_for "a configured file resource" do
|
|
391
391
|
end
|
392
392
|
|
393
393
|
def binread(file)
|
394
|
-
content = File.
|
394
|
+
content = File.binread(file)
|
395
395
|
content.force_encoding(Encoding::BINARY) if "".respond_to?(:force_encoding)
|
396
396
|
content
|
397
397
|
end
|