chef 17.0.242 → 17.1.35
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 +0 -12
- data/Rakefile +2 -2
- data/chef.gemspec +9 -20
- data/lib/chef/chef_fs/file_pattern.rb +2 -2
- data/lib/chef/compliance/default_attributes.rb +1 -1
- data/lib/chef/compliance/reporter/automate.rb +1 -1
- data/lib/chef/compliance/runner.rb +2 -2
- data/lib/chef/cookbook/cookbook_version_loader.rb +3 -3
- data/lib/chef/cookbook/gem_installer.rb +5 -1
- data/lib/chef/dsl/declare_resource.rb +5 -10
- data/lib/chef/formatters/doc.rb +2 -1
- data/lib/chef/node.rb +1 -1
- data/lib/chef/provider/directory.rb +6 -6
- data/lib/chef/provider/link.rb +1 -1
- data/lib/chef/provider/package/dnf/dnf_helper.py +11 -10
- data/lib/chef/provider/package/dnf/python_helper.rb +9 -8
- data/lib/chef/provider/package/yum.rb +1 -4
- data/lib/chef/provider/package/yum/python_helper.rb +15 -10
- data/lib/chef/provider/package/yum/yum_helper.py +46 -62
- data/lib/chef/provider/registry_key.rb +1 -1
- data/lib/chef/provider/service/systemd.rb +1 -1
- data/lib/chef/provider/systemd_unit.rb +1 -1
- data/lib/chef/provider/template/content.rb +1 -1
- data/lib/chef/provider/windows_script.rb +1 -1
- data/lib/chef/resource.rb +6 -7
- data/lib/chef/resource/execute.rb +2 -2
- data/lib/chef/resource/inspec_waiver_file_entry.rb +155 -0
- data/lib/chef/resource/lwrp_base.rb +17 -2
- data/lib/chef/resource/remote_file.rb +2 -2
- data/lib/chef/resource/windows_env.rb +1 -1
- data/lib/chef/resource/windows_font.rb +1 -1
- data/lib/chef/resource/windows_pagefile.rb +2 -2
- data/lib/chef/resource/windows_path.rb +2 -2
- data/lib/chef/resource/windows_security_policy.rb +5 -2
- data/lib/chef/resource/windows_task.rb +1 -1
- data/lib/chef/resource_builder.rb +8 -2
- data/lib/chef/resources.rb +1 -0
- data/lib/chef/run_lock.rb +1 -1
- data/lib/chef/runner.rb +1 -1
- data/lib/chef/shell/ext.rb +3 -3
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/api.rb +9 -2
- data/spec/data/knife-home/.chef/plugins/knife/example_home_subcommand.rb +0 -0
- data/spec/data/knife-site-subcommands/plugins/knife/example_subcommand.rb +0 -0
- data/spec/data/knife_subcommand/test_explicit_category.rb +7 -0
- data/spec/data/knife_subcommand/test_name_mapping.rb +4 -0
- data/spec/data/knife_subcommand/test_yourself.rb +21 -0
- data/spec/functional/resource/dnf_package_spec.rb +857 -537
- data/spec/functional/resource/group_spec.rb +1 -1
- data/spec/functional/resource/link_spec.rb +1 -1
- data/spec/functional/resource/remote_file_spec.rb +1 -1
- data/spec/functional/resource/windows_env_spec.rb +2 -2
- data/spec/functional/resource/yum_package_spec.rb +495 -428
- data/spec/integration/client/client_spec.rb +0 -20
- data/spec/integration/recipes/unified_mode_spec.rb +70 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/support/chef_helpers.rb +1 -1
- data/spec/support/shared/functional/execute_resource.rb +1 -1
- data/spec/support/shared/functional/knife.rb +37 -0
- data/spec/support/shared/integration/knife_support.rb +192 -0
- data/spec/support/shared/unit/knife_shared.rb +39 -0
- data/spec/support/shared/unit/provider/file.rb +1 -1
- data/spec/unit/chef_fs/file_system/repository/directory_spec.rb +1 -1
- data/spec/unit/compliance/runner_spec.rb +1 -1
- data/spec/unit/provider/link_spec.rb +1 -1
- data/spec/unit/provider/package/dnf/python_helper_spec.rb +1 -0
- data/spec/unit/provider/package/yum/python_helper_spec.rb +1 -0
- data/spec/unit/provider/service/systemd_service_spec.rb +2 -2
- data/spec/unit/provider/systemd_unit_spec.rb +2 -2
- data/spec/unit/resource/inspec_waiver_file_entry_spec.rb +80 -0
- data/tasks/rspec.rb +4 -9
- metadata +16 -160
- data/lib/chef/provider/package/yum/simplejson/LICENSE.txt +0 -79
- data/lib/chef/provider/package/yum/simplejson/__init__.py +0 -318
- data/lib/chef/provider/package/yum/simplejson/__init__.pyc +0 -0
- data/lib/chef/provider/package/yum/simplejson/decoder.py +0 -354
- data/lib/chef/provider/package/yum/simplejson/decoder.pyc +0 -0
- data/lib/chef/provider/package/yum/simplejson/encoder.py +0 -440
- data/lib/chef/provider/package/yum/simplejson/encoder.pyc +0 -0
- data/lib/chef/provider/package/yum/simplejson/scanner.py +0 -65
- data/lib/chef/provider/package/yum/simplejson/scanner.pyc +0 -0
- data/lib/chef/provider/package/yum/simplejson/tool.py +0 -37
@@ -349,26 +349,6 @@ describe "chef-client" do
|
|
349
349
|
expect(result.stdout).to include("Run List is [recipe[x::default]]")
|
350
350
|
result.error!
|
351
351
|
end
|
352
|
-
|
353
|
-
it "should complete with success when using --profile-ruby and output a profile file", :not_supported_on_aix do
|
354
|
-
file "config/client.rb", <<~EOM
|
355
|
-
local_mode true
|
356
|
-
cookbook_path "#{path_to("cookbooks")}"
|
357
|
-
EOM
|
358
|
-
result = shell_out!("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' -z --profile-ruby", cwd: chef_dir)
|
359
|
-
result.error!
|
360
|
-
expect(File.exist?(path_to("config/local-mode-cache/cache/graph_profile.out"))).to be true
|
361
|
-
end
|
362
|
-
|
363
|
-
it "doesn't produce a profile when --profile-ruby is not present" do
|
364
|
-
file "config/client.rb", <<~EOM
|
365
|
-
local_mode true
|
366
|
-
cookbook_path "#{path_to("cookbooks")}"
|
367
|
-
EOM
|
368
|
-
result = shell_out!("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' -z", cwd: chef_dir)
|
369
|
-
result.error!
|
370
|
-
expect(File.exist?(path_to("config/local-mode-cache/cache/graph_profile.out"))).to be false
|
371
|
-
end
|
372
352
|
end
|
373
353
|
|
374
354
|
when_the_repository "has a cookbook that outputs some node attributes" do
|
@@ -874,4 +874,74 @@ describe "Unified Mode" do
|
|
874
874
|
result.error!
|
875
875
|
end
|
876
876
|
end
|
877
|
+
|
878
|
+
when_the_repository "has a resource that uses edit_resource to create a subresource" do
|
879
|
+
before do
|
880
|
+
directory "cookbooks/x" do
|
881
|
+
file "recipes/default.rb", <<~EOM
|
882
|
+
my_resource "doit"
|
883
|
+
EOM
|
884
|
+
|
885
|
+
file "resources/my_resource.rb", <<~EOM
|
886
|
+
unified_mode true
|
887
|
+
provides :my_resource
|
888
|
+
|
889
|
+
action :doit do
|
890
|
+
edit_resource(:log, "name") do
|
891
|
+
message "GOOD"
|
892
|
+
level :warn
|
893
|
+
end
|
894
|
+
end
|
895
|
+
EOM
|
896
|
+
end
|
897
|
+
end
|
898
|
+
|
899
|
+
it "recipes should still have a compile/converge mode" do
|
900
|
+
file "config/client.rb", <<~EOM
|
901
|
+
local_mode true
|
902
|
+
cookbook_path "#{path_to("cookbooks")}"
|
903
|
+
log_level :warn
|
904
|
+
EOM
|
905
|
+
|
906
|
+
result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" --no-color -F doc -o 'x::default'", cwd: chef_dir)
|
907
|
+
# in recipe mode we should still run normally with a compile/converge mode
|
908
|
+
expect(result.stdout).to include("GOOD")
|
909
|
+
result.error!
|
910
|
+
end
|
911
|
+
end
|
912
|
+
|
913
|
+
when_the_repository "has a resource that uses find_resource to create a subresource" do
|
914
|
+
before do
|
915
|
+
directory "cookbooks/x" do
|
916
|
+
file "recipes/default.rb", <<~EOM
|
917
|
+
my_resource "doit"
|
918
|
+
EOM
|
919
|
+
|
920
|
+
file "resources/my_resource.rb", <<~EOM
|
921
|
+
unified_mode true
|
922
|
+
provides :my_resource
|
923
|
+
|
924
|
+
action :doit do
|
925
|
+
find_resource(:log, "name") do
|
926
|
+
message "GOOD"
|
927
|
+
level :warn
|
928
|
+
end
|
929
|
+
end
|
930
|
+
EOM
|
931
|
+
end
|
932
|
+
end
|
933
|
+
|
934
|
+
it "recipes should still have a compile/converge mode" do
|
935
|
+
file "config/client.rb", <<~EOM
|
936
|
+
local_mode true
|
937
|
+
cookbook_path "#{path_to("cookbooks")}"
|
938
|
+
log_level :warn
|
939
|
+
EOM
|
940
|
+
|
941
|
+
result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" --no-color -F doc -o 'x::default'", cwd: chef_dir)
|
942
|
+
# in recipe mode we should still run normally with a compile/converge mode
|
943
|
+
expect(result.stdout).to include("GOOD")
|
944
|
+
result.error!
|
945
|
+
end
|
946
|
+
end
|
877
947
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -43,7 +43,7 @@ end
|
|
43
43
|
# This is a helper to canonicalize paths that we're using in the file
|
44
44
|
# tests.
|
45
45
|
def canonicalize_path(path)
|
46
|
-
windows? ? path.tr("/",
|
46
|
+
windows? ? path.tr("/", "\\") : path
|
47
47
|
end
|
48
48
|
|
49
49
|
# Makes a temp directory with a canonical path on any platform.
|
@@ -58,7 +58,7 @@ shared_context "a command that can be executed as an alternate user" do
|
|
58
58
|
include Chef::Mixin::ShellOut
|
59
59
|
|
60
60
|
before do
|
61
|
-
shell_out!("icacls \"#{script_output_dir.tr("/",
|
61
|
+
shell_out!("icacls \"#{script_output_dir.tr("/", "\\")}\" /grant \"authenticated users:(F)\"")
|
62
62
|
end
|
63
63
|
|
64
64
|
after do
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
+
# Author:: AJ Christensen (<aj@junglist.gen.nz>)
|
4
|
+
# Author:: Ho-Sheng Hsiao (<hosh@chef.io>)
|
5
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
6
|
+
# License:: Apache License, Version 2.0
|
7
|
+
#
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
# you may not use this file except in compliance with the License.
|
10
|
+
# You may obtain a copy of the License at
|
11
|
+
#
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
#
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
# See the License for the specific language governing permissions and
|
18
|
+
# limitations under the License.
|
19
|
+
#
|
20
|
+
module SpecHelpers
|
21
|
+
module Knife
|
22
|
+
def redefine_argv(value)
|
23
|
+
Object.send(:remove_const, :ARGV)
|
24
|
+
Object.send(:const_set, :ARGV, value)
|
25
|
+
end
|
26
|
+
|
27
|
+
def with_argv(*argv)
|
28
|
+
original_argv = ARGV
|
29
|
+
redefine_argv(argv.flatten)
|
30
|
+
begin
|
31
|
+
yield
|
32
|
+
ensure
|
33
|
+
redefine_argv(original_argv)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,192 @@
|
|
1
|
+
#
|
2
|
+
# Author:: John Keiser (<jkeiser@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
|
18
|
+
require "chef/config"
|
19
|
+
require "chef/knife"
|
20
|
+
require "chef/application/knife"
|
21
|
+
require "logger"
|
22
|
+
require "chef/log"
|
23
|
+
require "chef/chef_fs/file_system_cache"
|
24
|
+
|
25
|
+
module KnifeSupport
|
26
|
+
DEBUG = ENV["DEBUG"]
|
27
|
+
def knife(*args, input: nil, instance_filter: nil)
|
28
|
+
# Allow knife('role from file roles/blah.json') rather than requiring the
|
29
|
+
# arguments to be split like knife('role', 'from', 'file', 'roles/blah.json')
|
30
|
+
# If any argument will have actual spaces in it, the long form is required.
|
31
|
+
# (Since knife commands always start with the command name, and command
|
32
|
+
# names with spaces are always multiple args, this is safe.)
|
33
|
+
if args.length == 1
|
34
|
+
args = args[0].split(/\s+/)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Make output stable
|
38
|
+
Chef::Config[:concurrency] = 1
|
39
|
+
|
40
|
+
# Work on machines where we can't access /var
|
41
|
+
Dir.mktmpdir("checksums") do |checksums_cache_dir|
|
42
|
+
Chef::Config[:syntax_check_cache_path] = checksums_cache_dir
|
43
|
+
|
44
|
+
# This is Chef::Knife.run without load_commands--we'll load stuff
|
45
|
+
# ourselves, thank you very much
|
46
|
+
stdout = StringIO.new
|
47
|
+
stderr = StringIO.new
|
48
|
+
|
49
|
+
stdin = if input
|
50
|
+
StringIO.new(input)
|
51
|
+
else
|
52
|
+
STDIN
|
53
|
+
end
|
54
|
+
|
55
|
+
begin
|
56
|
+
puts "knife: #{args.join(" ")}" if DEBUG
|
57
|
+
subcommand_class = Chef::Knife.subcommand_class_from(args)
|
58
|
+
subcommand_class.options = Chef::Application::Knife.options.merge(subcommand_class.options)
|
59
|
+
subcommand_class.load_deps
|
60
|
+
instance = subcommand_class.new(args)
|
61
|
+
|
62
|
+
# Load configs
|
63
|
+
instance.merge_configs
|
64
|
+
|
65
|
+
# Capture stdout/stderr
|
66
|
+
instance.ui = Chef::Knife::UI.new(stdout, stderr, stdin, instance.config.merge(disable_editing: true))
|
67
|
+
|
68
|
+
# Don't print stuff
|
69
|
+
Chef::Config[:verbosity] = ( DEBUG ? 2 : 0 )
|
70
|
+
instance.config[:config_file] = File.join(CHEF_SPEC_DATA, "null_config.rb")
|
71
|
+
|
72
|
+
# Ensure the ChefFS cache is empty
|
73
|
+
Chef::ChefFS::FileSystemCache.instance.reset!
|
74
|
+
|
75
|
+
# Configure chef with a (mostly) blank knife.rb
|
76
|
+
# We set a global and then mutate it in our stub knife.rb so we can be
|
77
|
+
# extra sure that we're not loading someone's real knife.rb and then
|
78
|
+
# running test scenarios against a real chef server. If things don't
|
79
|
+
# smell right, abort.
|
80
|
+
|
81
|
+
# To ensure that we don't pick up a user's credentials file we lie through our teeth about
|
82
|
+
# it's existence.
|
83
|
+
allow(File).to receive(:file?).and_call_original
|
84
|
+
allow(File).to receive(:file?).with(File.expand_path("~/.chef/credentials")).and_return(false)
|
85
|
+
|
86
|
+
# Set a canary that is modified by the default null_config.rb config file.
|
87
|
+
$__KNIFE_INTEGRATION_FAILSAFE_CHECK = "ole"
|
88
|
+
|
89
|
+
# Allow tweaking the knife instance before configuration.
|
90
|
+
instance_filter.call(instance) if instance_filter
|
91
|
+
|
92
|
+
instance.configure_chef
|
93
|
+
|
94
|
+
# The canary is incorrect, meaning the normal null_config.rb didn't run. Something is wrong.
|
95
|
+
unless $__KNIFE_INTEGRATION_FAILSAFE_CHECK == "ole ole"
|
96
|
+
raise Exception, "Potential misconfiguration of integration tests detected. Aborting test."
|
97
|
+
end
|
98
|
+
|
99
|
+
logger = Logger.new(stderr)
|
100
|
+
logger.formatter = proc { |severity, datetime, progname, msg| "#{severity}: #{msg}\n" }
|
101
|
+
Chef::Log.use_log_devices([logger])
|
102
|
+
Chef::Log.level = ( DEBUG ? :debug : :warn )
|
103
|
+
Chef::Log::Formatter.show_time = false
|
104
|
+
|
105
|
+
instance.run_with_pretty_exceptions(true)
|
106
|
+
|
107
|
+
exit_code = 0
|
108
|
+
|
109
|
+
# This is how rspec catches exit()
|
110
|
+
rescue SystemExit => e
|
111
|
+
exit_code = e.status
|
112
|
+
ensure
|
113
|
+
Chef::Config.delete(:syntax_check_cache_path)
|
114
|
+
Chef::Config.delete(:concurrency)
|
115
|
+
end
|
116
|
+
|
117
|
+
KnifeResult.new(stdout.string, stderr.string, exit_code)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
class KnifeResult
|
122
|
+
|
123
|
+
include ::RSpec::Matchers
|
124
|
+
|
125
|
+
def initialize(stdout, stderr, exit_code)
|
126
|
+
@stdout = stdout
|
127
|
+
@stderr = stderr
|
128
|
+
@exit_code = exit_code
|
129
|
+
end
|
130
|
+
|
131
|
+
attr_reader :stdout
|
132
|
+
attr_reader :stderr
|
133
|
+
attr_reader :exit_code
|
134
|
+
|
135
|
+
def should_fail(*args)
|
136
|
+
expected = {}
|
137
|
+
args.each do |arg|
|
138
|
+
if arg.is_a?(Hash)
|
139
|
+
expected.merge!(arg)
|
140
|
+
elsif arg.is_a?(Integer)
|
141
|
+
expected[:exit_code] = arg
|
142
|
+
else
|
143
|
+
expected[:stderr] = arg
|
144
|
+
end
|
145
|
+
end
|
146
|
+
expected[:exit_code] = 1 unless expected[:exit_code]
|
147
|
+
should_result_in(expected)
|
148
|
+
end
|
149
|
+
|
150
|
+
def should_succeed(*args)
|
151
|
+
expected = {}
|
152
|
+
args.each do |arg|
|
153
|
+
if arg.is_a?(Hash)
|
154
|
+
expected.merge!(arg)
|
155
|
+
else
|
156
|
+
expected[:stdout] = arg
|
157
|
+
end
|
158
|
+
end
|
159
|
+
should_result_in(expected)
|
160
|
+
end
|
161
|
+
|
162
|
+
private
|
163
|
+
|
164
|
+
def should_result_in(expected)
|
165
|
+
expected[:stdout] = "" unless expected[:stdout]
|
166
|
+
expected[:stdout] = expected[:stdout].is_a?(String) ? expected[:stdout].gsub(/[ \t\f\v]+$/, "") : expected[:stdout]
|
167
|
+
expected[:stderr] = "" unless expected[:stderr]
|
168
|
+
expected[:stderr] = expected[:stderr].is_a?(String) ? expected[:stderr].gsub(/[ \t\f\v]+$/, "") : expected[:stderr]
|
169
|
+
expected[:exit_code] = 0 unless expected[:exit_code]
|
170
|
+
# TODO make this go away
|
171
|
+
stderr_actual = @stderr.sub(/^WARNING: No knife configuration file found\n/, "")
|
172
|
+
stderr_actual = stderr_actual.gsub(/[ \t\f\v]+$/, "")
|
173
|
+
stdout_actual = @stdout
|
174
|
+
stdout_actual = stdout_actual.gsub(/[ \t\f\v]+$/, "")
|
175
|
+
if ChefUtils.windows?
|
176
|
+
stderr_actual = stderr_actual.gsub("\r\n", "\n")
|
177
|
+
stdout_actual = stdout_actual.gsub("\r\n", "\n")
|
178
|
+
end
|
179
|
+
if expected[:stderr].is_a?(Regexp)
|
180
|
+
expect(stderr_actual).to match(expected[:stderr])
|
181
|
+
else
|
182
|
+
expect(stderr_actual).to eq(expected[:stderr])
|
183
|
+
end
|
184
|
+
expect(@exit_code).to eq(expected[:exit_code])
|
185
|
+
if expected[:stdout].is_a?(Regexp)
|
186
|
+
expect(stdout_actual).to match(expected[:stdout])
|
187
|
+
else
|
188
|
+
expect(stdout_actual).to eq(expected[:stdout])
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Tyler Cloke (<tyler@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
shared_examples_for "mandatory field missing" do
|
20
|
+
context "when field is nil" do
|
21
|
+
before do
|
22
|
+
knife.name_args = name_args
|
23
|
+
end
|
24
|
+
|
25
|
+
it "exits 1" do
|
26
|
+
expect { knife.run }.to raise_error(SystemExit)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "prints the usage" do
|
30
|
+
expect(knife).to receive(:show_usage)
|
31
|
+
expect { knife.run }.to raise_error(SystemExit)
|
32
|
+
end
|
33
|
+
|
34
|
+
it "prints a relevant error message" do
|
35
|
+
expect { knife.run }.to raise_error(SystemExit)
|
36
|
+
expect(stderr.string).to match(/You must specify a #{fieldname}/)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -36,7 +36,7 @@ end
|
|
36
36
|
|
37
37
|
# forwards-vs-reverse slashes on windows sucks
|
38
38
|
def windows_path
|
39
|
-
windows? ? normalized_path.tr(
|
39
|
+
windows? ? normalized_path.tr("\\", "/") : normalized_path
|
40
40
|
end
|
41
41
|
|
42
42
|
# this is all getting a bit stupid, CHEF-4802 cut to remove all this
|
@@ -234,7 +234,7 @@ describe Chef::Compliance::Runner do
|
|
234
234
|
inputs = runner.inspec_opts[:inputs]
|
235
235
|
|
236
236
|
expect(inputs["tacos"]).to eq("lunch")
|
237
|
-
expect(inputs["chef_node"]["audit"]["reporter"]).to eq(
|
237
|
+
expect(inputs["chef_node"]["audit"]["reporter"]).to eq(%w{json-file cli})
|
238
238
|
expect(inputs["chef_node"]["chef_environment"]).to eq("_default")
|
239
239
|
end
|
240
240
|
end
|
@@ -23,6 +23,7 @@ require "spec_helper"
|
|
23
23
|
exclude_test = !(%w{rhel fedora amazon}.include?(ohai[:platform_family]) && File.exist?("/usr/bin/dnf"))
|
24
24
|
describe Chef::Provider::Package::Dnf::PythonHelper, :requires_root, external: exclude_test do
|
25
25
|
let(:helper) { Chef::Provider::Package::Dnf::PythonHelper.instance }
|
26
|
+
before(:each) { Singleton.__init__(Chef::Provider::Package::Dnf::PythonHelper) }
|
26
27
|
|
27
28
|
it "propagates stacktraces on stderr from the forked subprocess", :rhel do
|
28
29
|
allow(helper).to receive(:dnf_command).and_return("ruby -e 'raise \"your hands in the air\"'")
|