chef 17.9.18-universal-mingw32 → 17.9.26-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 +4 -4
- data/Gemfile +1 -1
- data/lib/chef/application/exit_code.rb +7 -21
- data/lib/chef/cookbook/syntax_check.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/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/remote_file.rb +1 -1
- data/lib/chef/resource.rb +2 -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/version.rb +1 -1
- data/spec/spec_helper.rb +3 -3
- data/spec/support/platform_helpers.rb +1 -1
- data/spec/support/ruby_installer.rb +1 -1
- data/spec/support/shared/functional/file_resource.rb +1 -1
- data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +1 -1
- 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/resource/conditional_spec.rb +4 -4
- data/spec/unit/resource_spec.rb +2 -2
- 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: d31041b6afb2214cc5546fd90d43af386e8886c5c053bf153b389b0e79b7d28d
|
4
|
+
data.tar.gz: 8ecdc88897779cebb02c552cdbb773588f3bc2d82f9e82b88f42d68d7299ebb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4dd2860217bb8c921be9325dad881ecd29ce7c819f13bf19ca0d6c34a69bb9c48076ea9509d12a01166f9905f89fedeb3df1b93361e4aed223a59e44451643a
|
7
|
+
data.tar.gz: be544b0a7d24fd4f5b6dc835d659b7f1b1b35120782c912e7a35a57b8728d16ac81860397ca0044b493eca339284998edb21ff218ff0ac124e3ad1cebe2f0fc2
|
data/Gemfile
CHANGED
@@ -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
|
|
@@ -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)
|
@@ -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
|
@@ -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
|
@@ -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
|
@@ -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
|
@@ -1096,7 +1096,7 @@ class Chef
|
|
1096
1096
|
rescue NameError => e
|
1097
1097
|
# This can happen when attempting to load a provider in a platform-specific
|
1098
1098
|
# environment where we have not required the necessary files yet
|
1099
|
-
raise unless
|
1099
|
+
raise unless /uninitialized constant/.match?(e.message)
|
1100
1100
|
end
|
1101
1101
|
|
1102
1102
|
# 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
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 }
|
@@ -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
|
@@ -169,7 +169,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
|
|
169
169
|
before do
|
170
170
|
provider.new_resource.system true
|
171
171
|
# there is no public API to set attribute's value to nil
|
172
|
-
provider.new_resource.instance_variable_set(
|
172
|
+
provider.new_resource.instance_variable_set(:@home, nil)
|
173
173
|
end
|
174
174
|
|
175
175
|
it "should not include -m or -d in the command options" do
|
@@ -31,22 +31,22 @@ describe Chef::Resource::RegistryKey do
|
|
31
31
|
|
32
32
|
context "tests registry dsl" do
|
33
33
|
it "resource can access registry_helper method registry_key_exists" do
|
34
|
-
expect(@resource.respond_to?(
|
34
|
+
expect(@resource.respond_to?(:registry_key_exists?)).to eq(true)
|
35
35
|
end
|
36
36
|
it "resource can access registry_helper method registry_get_values" do
|
37
|
-
expect(@resource.respond_to?(
|
37
|
+
expect(@resource.respond_to?(:registry_get_values)).to eq(true)
|
38
38
|
end
|
39
39
|
it "resource can access registry_helper method registry_has_subkey" do
|
40
|
-
expect(@resource.respond_to?(
|
40
|
+
expect(@resource.respond_to?(:registry_has_subkeys?)).to eq(true)
|
41
41
|
end
|
42
42
|
it "resource can access registry_helper method registry_get_subkeys" do
|
43
|
-
expect(@resource.respond_to?(
|
43
|
+
expect(@resource.respond_to?(:registry_get_subkeys)).to eq(true)
|
44
44
|
end
|
45
45
|
it "resource can access registry_helper method registry_value_exists" do
|
46
|
-
expect(@resource.respond_to?(
|
46
|
+
expect(@resource.respond_to?(:registry_value_exists?)).to eq(true)
|
47
47
|
end
|
48
48
|
it "resource can access registry_helper method data_value_exists" do
|
49
|
-
expect(@resource.respond_to?(
|
49
|
+
expect(@resource.respond_to?(:registry_data_exists?)).to eq(true)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
@@ -94,7 +94,7 @@ describe Chef::GuardInterpreter::ResourceGuardInterpreter do
|
|
94
94
|
|
95
95
|
describe "script command opts switch" do
|
96
96
|
let(:guard_interpreter) { Chef::GuardInterpreter::ResourceGuardInterpreter.new(parent_resource, "exit 0", {}) }
|
97
|
-
let(:resource) { guard_interpreter.instance_variable_get(
|
97
|
+
let(:resource) { guard_interpreter.instance_variable_get(:@resource) }
|
98
98
|
|
99
99
|
context "resource is a Script" do
|
100
100
|
context "and guard_interpreter is a :script" do
|
data/spec/unit/lwrp_spec.rb
CHANGED
@@ -54,7 +54,7 @@ describe "LWRP" do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
it "should not skip loading a resource when there's a top level symbol of the same name" do
|
57
|
-
Object.const_set(
|
57
|
+
Object.const_set(:LwrpFoo, Class.new)
|
58
58
|
file = File.expand_path( "lwrp/resources/foo.rb", CHEF_SPEC_DATA)
|
59
59
|
expect(Chef::Log).not_to receive(:info).with(/Skipping/)
|
60
60
|
expect(Chef::Log).not_to receive(:trace).with(/anymore/)
|
@@ -63,7 +63,7 @@ describe "LWRP" do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
it "should not skip loading a provider when there's a top level symbol of the same name" do
|
66
|
-
Object.const_set(
|
66
|
+
Object.const_set(:LwrpBuckPasser, Class.new)
|
67
67
|
file = File.expand_path( "lwrp/providers/buck_passer.rb", CHEF_SPEC_DATA)
|
68
68
|
expect(Chef::Log).not_to receive(:info).with(/Skipping/)
|
69
69
|
expect(Chef::Log).not_to receive(:trace).with(/anymore/)
|
@@ -39,21 +39,21 @@ describe Chef::Provider::DscScript do
|
|
39
39
|
it "describes the resource as converged if there were 0 DSC resources" do
|
40
40
|
allow(provider).to receive(:run_configuration).with(:test).and_return([])
|
41
41
|
provider.load_current_resource
|
42
|
-
expect(provider.instance_variable_get(
|
42
|
+
expect(provider.instance_variable_get(:@resource_converged)).to be_truthy
|
43
43
|
end
|
44
44
|
|
45
45
|
it "describes the resource as not converged if there is 1 DSC resources that is converged" do
|
46
46
|
dsc_resource_info = Chef::Util::DSC::ResourceInfo.new("resource", false, ["nothing will change something"])
|
47
47
|
allow(provider).to receive(:run_configuration).with(:test).and_return([dsc_resource_info])
|
48
48
|
provider.load_current_resource
|
49
|
-
expect(provider.instance_variable_get(
|
49
|
+
expect(provider.instance_variable_get(:@resource_converged)).to be_truthy
|
50
50
|
end
|
51
51
|
|
52
52
|
it "describes the resource as not converged if there is 1 DSC resources that is not converged" do
|
53
53
|
dsc_resource_info = Chef::Util::DSC::ResourceInfo.new("resource", true, ["will change something"])
|
54
54
|
allow(provider).to receive(:run_configuration).with(:test).and_return([dsc_resource_info])
|
55
55
|
provider.load_current_resource
|
56
|
-
expect(provider.instance_variable_get(
|
56
|
+
expect(provider.instance_variable_get(:@resource_converged)).to be_falsey
|
57
57
|
end
|
58
58
|
|
59
59
|
it "describes the resource as not converged if there are any DSC resources that are not converged" do
|
@@ -62,7 +62,7 @@ describe Chef::Provider::DscScript do
|
|
62
62
|
|
63
63
|
allow(provider).to receive(:run_configuration).with(:test).and_return([dsc_resource_info1, dsc_resource_info2])
|
64
64
|
provider.load_current_resource
|
65
|
-
expect(provider.instance_variable_get(
|
65
|
+
expect(provider.instance_variable_get(:@resource_converged)).to be_falsey
|
66
66
|
end
|
67
67
|
|
68
68
|
it "describes the resource as converged if all DSC resources that are converged" do
|
@@ -71,7 +71,7 @@ describe Chef::Provider::DscScript do
|
|
71
71
|
|
72
72
|
allow(provider).to receive(:run_configuration).with(:test).and_return([dsc_resource_info1, dsc_resource_info2])
|
73
73
|
provider.load_current_resource
|
74
|
-
expect(provider.instance_variable_get(
|
74
|
+
expect(provider.instance_variable_get(:@resource_converged)).to be_truthy
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
@@ -126,19 +126,19 @@ describe Chef::Provider::DscScript do
|
|
126
126
|
describe "#generate_description" do
|
127
127
|
it "removes the resource name from the beginning of any log line from the LCM" do
|
128
128
|
dsc_resource_info = Chef::Util::DSC::ResourceInfo.new("resourcename", true, ["resourcename doing something", "lastline"])
|
129
|
-
provider.instance_variable_set(
|
129
|
+
provider.instance_variable_set(:@dsc_resources_info, [dsc_resource_info])
|
130
130
|
expect(provider.send(:generate_description)[1]).to match(/converge DSC resource resourcename by doing something/)
|
131
131
|
end
|
132
132
|
|
133
133
|
it "ignores the last line" do
|
134
134
|
dsc_resource_info = Chef::Util::DSC::ResourceInfo.new("resourcename", true, ["resourcename doing something", "lastline"])
|
135
|
-
provider.instance_variable_set(
|
135
|
+
provider.instance_variable_set(:@dsc_resources_info, [dsc_resource_info])
|
136
136
|
expect(provider.send(:generate_description)[1]).not_to match(/lastline/)
|
137
137
|
end
|
138
138
|
|
139
139
|
it "reports a dsc resource has not been changed if the LCM reported no change was required" do
|
140
140
|
dsc_resource_info = Chef::Util::DSC::ResourceInfo.new("resourcename", false, ["resourcename does nothing", "lastline"])
|
141
|
-
provider.instance_variable_set(
|
141
|
+
provider.instance_variable_set(:@dsc_resources_info, [dsc_resource_info])
|
142
142
|
expect(provider.send(:generate_description)[1]).to match(/converge DSC resource resourcename by doing nothing/)
|
143
143
|
end
|
144
144
|
end
|
@@ -61,7 +61,7 @@ describe Chef::Provider::Group::Usermod do
|
|
61
61
|
@provider.action = :modify
|
62
62
|
@provider.define_resource_requirements
|
63
63
|
@provider.load_current_resource
|
64
|
-
@provider.instance_variable_set(
|
64
|
+
@provider.instance_variable_set(:@group_exists, true)
|
65
65
|
expect { @provider.run_action(@provider.process_resource_requirements) }.to raise_error(Chef::Exceptions::Group, "setting group members directly is not supported by #{@provider}, must set append true in group")
|
66
66
|
end
|
67
67
|
|
@@ -69,7 +69,7 @@ describe Chef::Provider::Group::Usermod do
|
|
69
69
|
@provider.action = :modify
|
70
70
|
@provider.define_resource_requirements
|
71
71
|
@provider.load_current_resource
|
72
|
-
@provider.instance_variable_set(
|
72
|
+
@provider.instance_variable_set(:@group_exists, true)
|
73
73
|
@new_resource.append(true)
|
74
74
|
@new_resource.excluded_members(["someone"])
|
75
75
|
expect { @provider.run_action(@provider.process_resource_requirements) }.to raise_error(Chef::Exceptions::Group, "excluded_members is not supported by #{@provider}")
|
@@ -68,8 +68,8 @@ describe Chef::Provider::Ifconfig::Aix do
|
|
68
68
|
it "should add an interface if it does not exist" do
|
69
69
|
@new_resource.device "en10"
|
70
70
|
allow(@provider).to receive(:load_current_resource) do
|
71
|
-
@provider.instance_variable_set(
|
72
|
-
@provider.instance_variable_set(
|
71
|
+
@provider.instance_variable_set(:@status, double("Status", exitstatus: 0))
|
72
|
+
@provider.instance_variable_set(:@current_resource, Chef::Resource::Ifconfig.new("10.0.0.1", @run_context))
|
73
73
|
end
|
74
74
|
command = "chdev -l #{@new_resource.device} -a netaddr=#{@new_resource.name}"
|
75
75
|
expect(@provider).to receive(:shell_out_compacted!).with(*command.split(" "))
|
@@ -82,8 +82,8 @@ describe Chef::Provider::Ifconfig::Aix do
|
|
82
82
|
@new_resource.device "en0"
|
83
83
|
@new_resource.metric "1"
|
84
84
|
allow(@provider).to receive(:load_current_resource) do
|
85
|
-
@provider.instance_variable_set(
|
86
|
-
@provider.instance_variable_set(
|
85
|
+
@provider.instance_variable_set(:@status, double("Status", exitstatus: 0))
|
86
|
+
@provider.instance_variable_set(:@current_resource, Chef::Resource::Ifconfig.new("10.0.0.1", @run_context))
|
87
87
|
end
|
88
88
|
|
89
89
|
expect { @provider.run_action(:add) }.to raise_error(Chef::Exceptions::Ifconfig, "interface metric property cannot be set for :add action")
|
@@ -94,8 +94,8 @@ describe Chef::Provider::Ifconfig::Aix do
|
|
94
94
|
it "should enable an interface if it does not exist" do
|
95
95
|
@new_resource.device "en10"
|
96
96
|
allow(@provider).to receive(:load_current_resource) do
|
97
|
-
@provider.instance_variable_set(
|
98
|
-
@provider.instance_variable_set(
|
97
|
+
@provider.instance_variable_set(:@status, double("Status", exitstatus: 0))
|
98
|
+
@provider.instance_variable_set(:@current_resource, Chef::Resource::Ifconfig.new("10.0.0.1", @run_context))
|
99
99
|
end
|
100
100
|
command = "ifconfig #{@new_resource.device} #{@new_resource.name}"
|
101
101
|
expect(@provider).to receive(:shell_out_compacted!).with(*command.split(" "))
|
@@ -110,8 +110,8 @@ describe Chef::Provider::Ifconfig::Aix do
|
|
110
110
|
it "should not disable an interface if it does not exist" do
|
111
111
|
@new_resource.device "en10"
|
112
112
|
allow(@provider).to receive(:load_current_resource) do
|
113
|
-
@provider.instance_variable_set(
|
114
|
-
@provider.instance_variable_set(
|
113
|
+
@provider.instance_variable_set(:@status, double("Status", exitstatus: 0))
|
114
|
+
@provider.instance_variable_set(:@current_resource, Chef::Resource::Ifconfig.new("10.0.0.1", @run_context))
|
115
115
|
end
|
116
116
|
|
117
117
|
expect(@provider).not_to receive(:shell_out_compacted!)
|
@@ -124,10 +124,10 @@ describe Chef::Provider::Ifconfig::Aix do
|
|
124
124
|
before do
|
125
125
|
@new_resource.device "en10"
|
126
126
|
allow(@provider).to receive(:load_current_resource) do
|
127
|
-
@provider.instance_variable_set(
|
127
|
+
@provider.instance_variable_set(:@status, double("Status", exitstatus: 0))
|
128
128
|
current_resource = Chef::Resource::Ifconfig.new("10.0.0.1", @run_context)
|
129
129
|
current_resource.device @new_resource.device
|
130
|
-
@provider.instance_variable_set(
|
130
|
+
@provider.instance_variable_set(:@current_resource, current_resource)
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
@@ -147,8 +147,8 @@ describe Chef::Provider::Ifconfig::Aix do
|
|
147
147
|
it "should not delete an interface if it does not exist" do
|
148
148
|
@new_resource.device "en10"
|
149
149
|
allow(@provider).to receive(:load_current_resource) do
|
150
|
-
@provider.instance_variable_set(
|
151
|
-
@provider.instance_variable_set(
|
150
|
+
@provider.instance_variable_set(:@status, double("Status", exitstatus: 0))
|
151
|
+
@provider.instance_variable_set(:@current_resource, Chef::Resource::Ifconfig.new("10.0.0.1", @run_context))
|
152
152
|
end
|
153
153
|
|
154
154
|
expect(@provider).not_to receive(:shell_out_compacted!)
|
@@ -161,10 +161,10 @@ describe Chef::Provider::Ifconfig::Aix do
|
|
161
161
|
before do
|
162
162
|
@new_resource.device "en10"
|
163
163
|
allow(@provider).to receive(:load_current_resource) do
|
164
|
-
@provider.instance_variable_set(
|
164
|
+
@provider.instance_variable_set(:@status, double("Status", exitstatus: 0))
|
165
165
|
current_resource = Chef::Resource::Ifconfig.new("10.0.0.1", @run_context)
|
166
166
|
current_resource.device @new_resource.device
|
167
|
-
@provider.instance_variable_set(
|
167
|
+
@provider.instance_variable_set(:@current_resource, current_resource)
|
168
168
|
end
|
169
169
|
end
|
170
170
|
|
@@ -42,7 +42,7 @@ describe Chef::Provider::Ifconfig::Debian do
|
|
42
42
|
let(:provider) do
|
43
43
|
status = double("Status", exitstatus: 0)
|
44
44
|
provider = Chef::Provider::Ifconfig::Debian.new(new_resource, run_context)
|
45
|
-
provider.instance_variable_set(
|
45
|
+
provider.instance_variable_set(:@status, status)
|
46
46
|
provider.current_resource = current_resource
|
47
47
|
allow(provider).to receive(:load_current_resource)
|
48
48
|
allow(provider).to receive(:shell_out!)
|
@@ -40,7 +40,7 @@ describe Chef::Provider::Ifconfig::Redhat do
|
|
40
40
|
@current_resource = Chef::Resource::Ifconfig.new("10.0.0.1", @run_context)
|
41
41
|
|
42
42
|
status = double("Status", exitstatus: 0)
|
43
|
-
@provider.instance_variable_set(
|
43
|
+
@provider.instance_variable_set(:@status, status)
|
44
44
|
@provider.current_resource = @current_resource
|
45
45
|
|
46
46
|
config_filename = "/etc/sysconfig/network-scripts/ifcfg-#{@new_resource.device}"
|
@@ -35,7 +35,7 @@ describe Chef::Provider::Ifconfig do
|
|
35
35
|
@current_resource = Chef::Resource::Ifconfig.new("10.0.0.1", @run_context)
|
36
36
|
|
37
37
|
status = double("Status", exitstatus: 0)
|
38
|
-
@provider.instance_variable_set(
|
38
|
+
@provider.instance_variable_set(:@status, status)
|
39
39
|
@provider.current_resource = @current_resource
|
40
40
|
end
|
41
41
|
|
@@ -58,7 +58,7 @@ describe Chef::Provider::Ifconfig do
|
|
58
58
|
@provider.load_current_resource
|
59
59
|
end
|
60
60
|
it "should track state of ifconfig failure" do
|
61
|
-
expect(@provider.instance_variable_get(
|
61
|
+
expect(@provider.instance_variable_get(:@status).exitstatus).not_to eq(0)
|
62
62
|
end
|
63
63
|
it "should thrown an exception when ifconfig fails" do
|
64
64
|
@provider.action = :add
|
@@ -79,7 +79,7 @@ describe Chef::Provider::Ifconfig do
|
|
79
79
|
@provider.load_current_resource
|
80
80
|
end
|
81
81
|
it "should track state of ifconfig failure" do
|
82
|
-
expect(@provider.instance_variable_get(
|
82
|
+
expect(@provider.instance_variable_get(:@status).exitstatus).not_to eq(0)
|
83
83
|
end
|
84
84
|
it "should thrown an exception when ifconfig fails" do
|
85
85
|
@provider.action = :add
|
@@ -219,11 +219,11 @@ describe Chef::Provider::RemoteFile::CacheControlData do
|
|
219
219
|
let(:truncated_remote_uri) { URI.parse(long_remote_path[0...CACHE_FILE_TRUNCATED_FRIENDLY_FILE_NAME_LENGTH]) }
|
220
220
|
let(:truncated_file_cache_path) do
|
221
221
|
cache_control_data_truncated = Chef::Provider::RemoteFile::CacheControlData.load_and_validate(truncated_remote_uri, current_file_checksum)
|
222
|
-
cache_control_data_truncated.send(
|
222
|
+
cache_control_data_truncated.send(:sanitized_cache_file_basename)[0...CACHE_FILE_TRUNCATED_FRIENDLY_FILE_NAME_LENGTH]
|
223
223
|
end
|
224
224
|
|
225
225
|
it "truncates the file cache path to 102 characters" do
|
226
|
-
normalized_cache_path = cache_control_data.send(
|
226
|
+
normalized_cache_path = cache_control_data.send(:sanitized_cache_file_basename)
|
227
227
|
|
228
228
|
expect(Chef::FileCache).to receive(:store).with("remote_file/" + normalized_cache_path, cache_control_data.json_data)
|
229
229
|
|
@@ -233,7 +233,7 @@ describe Chef::Provider::RemoteFile::CacheControlData do
|
|
233
233
|
end
|
234
234
|
|
235
235
|
it "uses a file cache path that starts with the first #{CACHE_FILE_TRUNCATED_FRIENDLY_FILE_NAME_LENGTH} characters of the URI" do
|
236
|
-
normalized_cache_path = cache_control_data.send(
|
236
|
+
normalized_cache_path = cache_control_data.send(:sanitized_cache_file_basename)
|
237
237
|
|
238
238
|
expect(truncated_file_cache_path.length).to eq(CACHE_FILE_TRUNCATED_FRIENDLY_FILE_NAME_LENGTH)
|
239
239
|
expect(normalized_cache_path.start_with?(truncated_file_cache_path)).to eq(true)
|
@@ -49,13 +49,13 @@ describe Chef::Provider::Service::Gentoo do
|
|
49
49
|
|
50
50
|
it "should track when service file is not found in /etc/runlevels" do
|
51
51
|
@provider.load_current_resource
|
52
|
-
expect(@provider.instance_variable_get(
|
52
|
+
expect(@provider.instance_variable_get(:@found_script)).to be_falsey
|
53
53
|
end
|
54
54
|
|
55
55
|
it "should track when service file is found in /etc/runlevels/**/" do
|
56
56
|
allow(Dir).to receive(:glob).with("/etc/runlevels/**/chef").and_return(["/etc/runlevels/default/chef"])
|
57
57
|
@provider.load_current_resource
|
58
|
-
expect(@provider.instance_variable_get(
|
58
|
+
expect(@provider.instance_variable_get(:@found_script)).to be_truthy
|
59
59
|
end
|
60
60
|
|
61
61
|
describe "when detecting the service enable state" do
|
@@ -160,7 +160,7 @@ describe Chef::Provider::Service::Upstart do
|
|
160
160
|
it "should track state when the upstart configuration file fails to load" do
|
161
161
|
expect(File).to receive(:exist?).and_return false
|
162
162
|
@provider.load_current_resource
|
163
|
-
expect(@provider.instance_variable_get(
|
163
|
+
expect(@provider.instance_variable_get(:@config_file_found)).to eq(false)
|
164
164
|
end
|
165
165
|
|
166
166
|
describe "when a status command has been specified" do
|
@@ -177,7 +177,7 @@ describe Chef::Provider::Service::Upstart do
|
|
177
177
|
it "should track state when the user-provided status command fails" do
|
178
178
|
allow(@provider).to receive(:shell_out!).and_raise(Errno::ENOENT)
|
179
179
|
@provider.load_current_resource
|
180
|
-
expect(@provider.instance_variable_get(
|
180
|
+
expect(@provider.instance_variable_get(:@command_success)).to eq(false)
|
181
181
|
end
|
182
182
|
|
183
183
|
it "should set running to false if it catches a Chef::Exceptions::Exec when using a status command" do
|
@@ -190,7 +190,7 @@ describe Chef::Provider::Service::Upstart do
|
|
190
190
|
it "should track state when we fail to obtain service status via upstart_goal_state" do
|
191
191
|
expect(@provider).to receive(:upstart_goal_state).and_raise Chef::Exceptions::Exec
|
192
192
|
@provider.load_current_resource
|
193
|
-
expect(@provider.instance_variable_get(
|
193
|
+
expect(@provider.instance_variable_get(:@command_success)).to eq(false)
|
194
194
|
end
|
195
195
|
|
196
196
|
it "should return the current resource" do
|
@@ -59,7 +59,7 @@ describe Chef::Resource::Conditional do
|
|
59
59
|
|
60
60
|
describe "after running a negative/false command given as a string" do
|
61
61
|
before do
|
62
|
-
@status.send("success?=", false)
|
62
|
+
@status.send(:"success?=", false)
|
63
63
|
@conditional = Chef::Resource::Conditional.only_if(@parent_resource, "false")
|
64
64
|
end
|
65
65
|
|
@@ -80,7 +80,7 @@ describe Chef::Resource::Conditional do
|
|
80
80
|
|
81
81
|
describe "after running a negative/false command given as an array" do
|
82
82
|
before do
|
83
|
-
@status.send("success?=", false)
|
83
|
+
@status.send(:"success?=", false)
|
84
84
|
@conditional = Chef::Resource::Conditional.only_if(@parent_resource, ["false"])
|
85
85
|
end
|
86
86
|
|
@@ -162,7 +162,7 @@ describe Chef::Resource::Conditional do
|
|
162
162
|
|
163
163
|
describe "after running a failed/false command given as a string" do
|
164
164
|
before do
|
165
|
-
@status.send("success?=", false)
|
165
|
+
@status.send(:"success?=", false)
|
166
166
|
@conditional = Chef::Resource::Conditional.not_if(@parent_resource, "false")
|
167
167
|
end
|
168
168
|
|
@@ -183,7 +183,7 @@ describe Chef::Resource::Conditional do
|
|
183
183
|
|
184
184
|
describe "after running a failed/false command given as an array" do
|
185
185
|
before do
|
186
|
-
@status.send("success?=", false)
|
186
|
+
@status.send(:"success?=", false)
|
187
187
|
@conditional = Chef::Resource::Conditional.not_if(@parent_resource, ["false"])
|
188
188
|
end
|
189
189
|
|
data/spec/unit/resource_spec.rb
CHANGED
@@ -955,7 +955,7 @@ describe Chef::Resource do
|
|
955
955
|
node.name("bumblebee")
|
956
956
|
node.automatic[:platform] = "autobots"
|
957
957
|
node.automatic[:platform_version] = "6.1"
|
958
|
-
Object.const_set(
|
958
|
+
Object.const_set(:Soundwave, klz1)
|
959
959
|
klz1.provides :soundwave
|
960
960
|
end
|
961
961
|
|
@@ -978,7 +978,7 @@ describe Chef::Resource do
|
|
978
978
|
node.automatic[:platform] = "autobots"
|
979
979
|
node.automatic[:platform_version] = "6.1"
|
980
980
|
klz2.provides :dinobot, platform: ["autobots"]
|
981
|
-
Object.const_set(
|
981
|
+
Object.const_set(:Grimlock, klz2)
|
982
982
|
klz2.provides :grimlock
|
983
983
|
end
|
984
984
|
|
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.
|
4
|
+
version: 17.9.26
|
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:
|
11
|
+
date: 2022-01-04 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.
|
19
|
+
version: 17.9.26
|
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.
|
26
|
+
version: 17.9.26
|
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.
|
33
|
+
version: 17.9.26
|
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.
|
40
|
+
version: 17.9.26
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: train-core
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|