chef 12.4.3 → 12.5.0.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -2
- data/lib/chef.rb +1 -1
- data/lib/chef/application/solo.rb +1 -1
- data/lib/chef/application/windows_service_manager.rb +17 -12
- data/lib/chef/chef_class.rb +7 -0
- data/lib/chef/chef_fs/config.rb +22 -24
- data/lib/chef/chef_fs/file_pattern.rb +4 -15
- data/lib/chef/chef_fs/file_system/cookbook_dir.rb +1 -0
- data/lib/chef/chef_fs/knife.rb +35 -7
- data/lib/chef/chef_fs/path_utils.rb +65 -34
- data/lib/chef/constants.rb +27 -0
- data/lib/chef/delayed_evaluator.rb +21 -0
- data/lib/chef/dsl/recipe.rb +20 -2
- data/lib/chef/event_dispatch/base.rb +40 -16
- data/lib/chef/event_dispatch/dsl.rb +64 -0
- data/lib/chef/exceptions.rb +6 -1
- data/lib/chef/formatters/doc.rb +3 -1
- data/lib/chef/guard_interpreter/resource_guard_interpreter.rb +3 -1
- data/lib/chef/http/http_request.rb +1 -1
- data/lib/chef/knife/bootstrap/templates/chef-full.erb +1 -1
- data/lib/chef/knife/ssl_check.rb +3 -2
- data/lib/chef/knife/user_edit.rb +1 -2
- data/lib/chef/mixin/params_validate.rb +362 -135
- data/lib/chef/node.rb +19 -0
- data/lib/chef/platform/handler_map.rb +0 -5
- data/lib/chef/platform/rebooter.rb +1 -1
- data/lib/chef/property.rb +539 -0
- data/lib/chef/provider.rb +129 -12
- data/lib/chef/provider/deploy.rb +3 -5
- data/lib/chef/provider/lwrp_base.rb +1 -75
- data/lib/chef/provider/package.rb +1 -1
- data/lib/chef/provider/powershell_script.rb +32 -19
- data/lib/chef/provider/registry_key.rb +5 -5
- data/lib/chef/provider/service/macosx.rb +5 -1
- data/lib/chef/recipe.rb +1 -8
- data/lib/chef/resource.rb +499 -84
- data/lib/chef/resource/file/verification.rb +7 -1
- data/lib/chef/resource/lwrp_base.rb +1 -7
- data/lib/chef/run_context.rb +404 -83
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/registry.rb +10 -2
- data/lib/chef/workstation_config_loader.rb +3 -158
- data/spec/data/run_context/cookbooks/include/recipes/default.rb +24 -0
- data/spec/data/run_context/cookbooks/include/recipes/includee.rb +3 -0
- data/spec/functional/rebooter_spec.rb +1 -1
- data/spec/functional/resource/{powershell_spec.rb → powershell_script_spec.rb} +3 -3
- data/spec/functional/win32/registry_helper_spec.rb +12 -0
- data/spec/functional/win32/service_manager_spec.rb +2 -2
- data/spec/integration/knife/chef_repo_path_spec.rb +13 -11
- data/spec/integration/recipes/recipe_dsl_spec.rb +0 -15
- data/spec/integration/recipes/resource_action_spec.rb +343 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/support/shared/functional/win32_service.rb +2 -1
- data/spec/unit/application/solo_spec.rb +4 -3
- data/spec/unit/chef_class_spec.rb +23 -0
- data/spec/unit/chef_fs/path_util_spec.rb +108 -0
- data/spec/unit/event_dispatch/dsl_spec.rb +87 -0
- data/spec/unit/json_compat_spec.rb +4 -3
- data/spec/unit/knife/ssl_check_spec.rb +4 -0
- data/spec/unit/mixin/params_validate_spec.rb +4 -2
- data/spec/unit/node_spec.rb +7 -0
- data/spec/unit/property/state_spec.rb +506 -0
- data/spec/unit/property/validation_spec.rb +658 -0
- data/spec/unit/property_spec.rb +968 -0
- data/spec/unit/provider/{powershell_spec.rb → powershell_script_spec.rb} +0 -0
- data/spec/unit/provider/registry_key_spec.rb +12 -0
- data/spec/unit/provider/service/macosx_spec.rb +4 -4
- data/spec/unit/provider_spec.rb +1 -3
- data/spec/unit/recipe_spec.rb +0 -4
- data/spec/unit/registry_helper_spec.rb +15 -1
- data/spec/unit/resource/file/verification_spec.rb +33 -5
- data/spec/unit/resource/{powershell_spec.rb → powershell_script_spec.rb} +0 -0
- data/spec/unit/resource_spec.rb +2 -2
- data/spec/unit/run_context/child_run_context_spec.rb +133 -0
- data/spec/unit/run_context_spec.rb +7 -0
- metadata +25 -25
- data/spec/unit/workstation_config_loader_spec.rb +0 -283
data/lib/chef/version.rb
CHANGED
data/lib/chef/win32/registry.rb
CHANGED
@@ -203,7 +203,7 @@ class Chef
|
|
203
203
|
key_exists!(key_path)
|
204
204
|
hive, key = get_hive_and_key(key_path)
|
205
205
|
hive.open(key, ::Win32::Registry::KEY_READ | registry_system_architecture) do |reg|
|
206
|
-
return true if reg.any? {|val| val == value[:name] }
|
206
|
+
return true if reg.any? {|val| safely_downcase(val) == safely_downcase(value[:name]) }
|
207
207
|
end
|
208
208
|
return false
|
209
209
|
end
|
@@ -213,7 +213,7 @@ class Chef
|
|
213
213
|
hive, key = get_hive_and_key(key_path)
|
214
214
|
hive.open(key, ::Win32::Registry::KEY_READ | registry_system_architecture) do |reg|
|
215
215
|
reg.each do |val_name, val_type, val_data|
|
216
|
-
if val_name == value[:name] &&
|
216
|
+
if safely_downcase(val_name) == safely_downcase(value[:name]) &&
|
217
217
|
val_type == get_type_from_name(value[:type]) &&
|
218
218
|
val_data == value[:data]
|
219
219
|
return true
|
@@ -289,6 +289,14 @@ class Chef
|
|
289
289
|
|
290
290
|
private
|
291
291
|
|
292
|
+
|
293
|
+
def safely_downcase(val)
|
294
|
+
if val.is_a? String
|
295
|
+
return val.downcase
|
296
|
+
end
|
297
|
+
return val
|
298
|
+
end
|
299
|
+
|
292
300
|
def node
|
293
301
|
run_context && run_context.node
|
294
302
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Author::
|
2
|
+
# Author:: Claire McQuin (<claire@chef.io>)
|
3
3
|
# Copyright:: Copyright (c) 2014 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
@@ -16,163 +16,8 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require 'chef/
|
20
|
-
require 'chef/config'
|
21
|
-
require 'chef/null_logger'
|
22
|
-
require 'chef/util/path_helper'
|
19
|
+
require 'chef-config/workstation_config_loader'
|
23
20
|
|
24
21
|
class Chef
|
25
|
-
|
26
|
-
class WorkstationConfigLoader
|
27
|
-
|
28
|
-
# Path to a config file requested by user, (e.g., via command line option). Can be nil
|
29
|
-
attr_accessor :explicit_config_file
|
30
|
-
|
31
|
-
# TODO: initialize this with a logger for Chef and Knife
|
32
|
-
def initialize(explicit_config_file, logger=nil)
|
33
|
-
@explicit_config_file = explicit_config_file
|
34
|
-
@config_location = nil
|
35
|
-
@logger = logger || NullLogger.new
|
36
|
-
end
|
37
|
-
|
38
|
-
def no_config_found?
|
39
|
-
config_location.nil?
|
40
|
-
end
|
41
|
-
|
42
|
-
def config_location
|
43
|
-
@config_location ||= (explicit_config_file || locate_local_config)
|
44
|
-
end
|
45
|
-
|
46
|
-
def chef_config_dir
|
47
|
-
if @chef_config_dir.nil?
|
48
|
-
@chef_config_dir = false
|
49
|
-
full_path = working_directory.split(File::SEPARATOR)
|
50
|
-
(full_path.length - 1).downto(0) do |i|
|
51
|
-
candidate_directory = File.join(full_path[0..i] + [".chef" ])
|
52
|
-
if File.exist?(candidate_directory) && File.directory?(candidate_directory)
|
53
|
-
@chef_config_dir = candidate_directory
|
54
|
-
break
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
@chef_config_dir
|
59
|
-
end
|
60
|
-
|
61
|
-
def load
|
62
|
-
# Ignore it if there's no explicit_config_file and can't find one at a
|
63
|
-
# default path.
|
64
|
-
return false if config_location.nil?
|
65
|
-
|
66
|
-
if explicit_config_file && !path_exists?(config_location)
|
67
|
-
raise Exceptions::ConfigurationError, "Specified config file #{config_location} does not exist"
|
68
|
-
end
|
69
|
-
|
70
|
-
# Have to set Chef::Config.config_file b/c other config is derived from it.
|
71
|
-
Chef::Config.config_file = config_location
|
72
|
-
read_config(IO.read(config_location), config_location)
|
73
|
-
end
|
74
|
-
|
75
|
-
# (Private API, public for test purposes)
|
76
|
-
def env
|
77
|
-
ENV
|
78
|
-
end
|
79
|
-
|
80
|
-
# (Private API, public for test purposes)
|
81
|
-
def path_exists?(path)
|
82
|
-
Pathname.new(path).expand_path.exist?
|
83
|
-
end
|
84
|
-
|
85
|
-
private
|
86
|
-
|
87
|
-
def have_config?(path)
|
88
|
-
if path_exists?(path)
|
89
|
-
logger.info("Using config at #{path}")
|
90
|
-
true
|
91
|
-
else
|
92
|
-
logger.debug("Config not found at #{path}, trying next option")
|
93
|
-
false
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
def locate_local_config
|
98
|
-
candidate_configs = []
|
99
|
-
|
100
|
-
# Look for $KNIFE_HOME/knife.rb (allow multiple knives config on same machine)
|
101
|
-
if env['KNIFE_HOME']
|
102
|
-
candidate_configs << File.join(env['KNIFE_HOME'], 'config.rb')
|
103
|
-
candidate_configs << File.join(env['KNIFE_HOME'], 'knife.rb')
|
104
|
-
end
|
105
|
-
# Look for $PWD/knife.rb
|
106
|
-
if Dir.pwd
|
107
|
-
candidate_configs << File.join(Dir.pwd, 'config.rb')
|
108
|
-
candidate_configs << File.join(Dir.pwd, 'knife.rb')
|
109
|
-
end
|
110
|
-
# Look for $UPWARD/.chef/knife.rb
|
111
|
-
if chef_config_dir
|
112
|
-
candidate_configs << File.join(chef_config_dir, 'config.rb')
|
113
|
-
candidate_configs << File.join(chef_config_dir, 'knife.rb')
|
114
|
-
end
|
115
|
-
# Look for $HOME/.chef/knife.rb
|
116
|
-
Chef::Util::PathHelper.home('.chef') do |dot_chef_dir|
|
117
|
-
candidate_configs << File.join(dot_chef_dir, 'config.rb')
|
118
|
-
candidate_configs << File.join(dot_chef_dir, 'knife.rb')
|
119
|
-
end
|
120
|
-
|
121
|
-
candidate_configs.find do | candidate_config |
|
122
|
-
have_config?(candidate_config)
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
def working_directory
|
127
|
-
a = if Chef::Platform.windows?
|
128
|
-
env['CD']
|
129
|
-
else
|
130
|
-
env['PWD']
|
131
|
-
end || Dir.pwd
|
132
|
-
|
133
|
-
a
|
134
|
-
end
|
135
|
-
|
136
|
-
def read_config(config_content, config_file_path)
|
137
|
-
Chef::Config.from_string(config_content, config_file_path)
|
138
|
-
rescue SignalException
|
139
|
-
raise
|
140
|
-
rescue SyntaxError => e
|
141
|
-
message = ""
|
142
|
-
message << "You have invalid ruby syntax in your config file #{config_file_path}\n\n"
|
143
|
-
message << "#{e.class.name}: #{e.message}\n"
|
144
|
-
if file_line = e.message[/#{Regexp.escape(config_file_path)}:[\d]+/]
|
145
|
-
line = file_line[/:([\d]+)$/, 1].to_i
|
146
|
-
message << highlight_config_error(config_file_path, line)
|
147
|
-
end
|
148
|
-
raise Exceptions::ConfigurationError, message
|
149
|
-
rescue Exception => e
|
150
|
-
message = "You have an error in your config file #{config_file_path}\n\n"
|
151
|
-
message << "#{e.class.name}: #{e.message}\n"
|
152
|
-
filtered_trace = e.backtrace.grep(/#{Regexp.escape(config_file_path)}/)
|
153
|
-
filtered_trace.each {|bt_line| message << " " << bt_line << "\n" }
|
154
|
-
if !filtered_trace.empty?
|
155
|
-
line_nr = filtered_trace.first[/#{Regexp.escape(config_file_path)}:([\d]+)/, 1]
|
156
|
-
message << highlight_config_error(config_file_path, line_nr.to_i)
|
157
|
-
end
|
158
|
-
raise Exceptions::ConfigurationError, message
|
159
|
-
end
|
160
|
-
|
161
|
-
|
162
|
-
def highlight_config_error(file, line)
|
163
|
-
config_file_lines = []
|
164
|
-
IO.readlines(file).each_with_index {|l, i| config_file_lines << "#{(i + 1).to_s.rjust(3)}: #{l.chomp}"}
|
165
|
-
if line == 1
|
166
|
-
lines = config_file_lines[0..3]
|
167
|
-
else
|
168
|
-
lines = config_file_lines[Range.new(line - 2, line)]
|
169
|
-
end
|
170
|
-
"Relevant file content:\n" + lines.join("\n") + "\n"
|
171
|
-
end
|
172
|
-
|
173
|
-
def logger
|
174
|
-
@logger
|
175
|
-
end
|
176
|
-
|
177
|
-
end
|
22
|
+
WorkstationConfigLoader = ChefConfig::WorkstationConfigLoader
|
178
23
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module ::RanResources
|
2
|
+
def self.resources
|
3
|
+
@resources ||= []
|
4
|
+
end
|
5
|
+
end
|
6
|
+
class RunContextCustomResource < Chef::Resource
|
7
|
+
action :create do
|
8
|
+
ruby_block '4' do
|
9
|
+
block { RanResources.resources << 4 }
|
10
|
+
end
|
11
|
+
recipe_eval do
|
12
|
+
ruby_block '1' do
|
13
|
+
block { RanResources.resources << 1 }
|
14
|
+
end
|
15
|
+
include_recipe 'include::includee'
|
16
|
+
ruby_block '3' do
|
17
|
+
block { RanResources.resources << 3 }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
ruby_block '5' do
|
21
|
+
block { RanResources.resources << 5 }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -125,16 +125,16 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
|
|
125
125
|
expect { resource.run_action(:run) }.not_to raise_error
|
126
126
|
end
|
127
127
|
|
128
|
-
it "raises
|
128
|
+
it "raises a Mixlib::ShellOut::ShellCommandFailed error if the script is not syntactically correct" do
|
129
129
|
resource.code('if({)')
|
130
130
|
resource.returns(0)
|
131
131
|
expect { resource.run_action(:run) }.to raise_error(Mixlib::ShellOut::ShellCommandFailed)
|
132
132
|
end
|
133
133
|
|
134
|
-
it "
|
134
|
+
it "raises an error if the script is not syntactically correct even if returns is set to 1 which is what powershell.exe returns for syntactically invalid scripts" do
|
135
135
|
resource.code('if({)')
|
136
136
|
resource.returns(1)
|
137
|
-
expect { resource.run_action(:run) }.
|
137
|
+
expect { resource.run_action(:run) }.to raise_error(Mixlib::ShellOut::ShellCommandFailed)
|
138
138
|
end
|
139
139
|
|
140
140
|
# This somewhat ambiguous case, two failures of different types,
|
@@ -130,6 +130,9 @@ describe 'Chef::Win32::Registry', :windows_only do
|
|
130
130
|
it "returns true if the value exists" do
|
131
131
|
expect(@registry.value_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals"})).to eq(true)
|
132
132
|
end
|
133
|
+
it "returns true if the value exists with a case mismatch on the value name" do
|
134
|
+
expect(@registry.value_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"petals"})).to eq(true)
|
135
|
+
end
|
133
136
|
it "returns false if the value does not exist" do
|
134
137
|
expect(@registry.value_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"FOOBAR"})).to eq(false)
|
135
138
|
end
|
@@ -145,6 +148,9 @@ describe 'Chef::Win32::Registry', :windows_only do
|
|
145
148
|
it "returns true if the value exists" do
|
146
149
|
expect(@registry.value_exists!("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals"})).to eq(true)
|
147
150
|
end
|
151
|
+
it "returns true if the value exists with a case mismatch on the value name" do
|
152
|
+
expect(@registry.value_exists!("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"petals"})).to eq(true)
|
153
|
+
end
|
148
154
|
it "throws an exception if the value does not exist" do
|
149
155
|
expect {@registry.value_exists!("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"FOOBAR"})}.to raise_error(Chef::Exceptions::Win32RegValueMissing)
|
150
156
|
end
|
@@ -160,6 +166,9 @@ describe 'Chef::Win32::Registry', :windows_only do
|
|
160
166
|
it "returns true if all the data matches" do
|
161
167
|
expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Pink", "Delicate"]})).to eq(true)
|
162
168
|
end
|
169
|
+
it "returns true if all the data matches with a case mismatch on the data name" do
|
170
|
+
expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"petals", :type=>:multi_string, :data=>["Pink", "Delicate"]})).to eq(true)
|
171
|
+
end
|
163
172
|
it "returns false if the name does not exist" do
|
164
173
|
expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"slateP", :type=>:multi_string, :data=>["Pink", "Delicate"]})).to eq(false)
|
165
174
|
end
|
@@ -181,6 +190,9 @@ describe 'Chef::Win32::Registry', :windows_only do
|
|
181
190
|
it "returns true if all the data matches" do
|
182
191
|
expect(@registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Pink", "Delicate"]})).to eq(true)
|
183
192
|
end
|
193
|
+
it "returns true if all the data matches with a case mismatch on the data name" do
|
194
|
+
expect(@registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"petals", :type=>:multi_string, :data=>["Pink", "Delicate"]})).to eq(true)
|
195
|
+
end
|
184
196
|
it "throws an exception if the name does not exist" do
|
185
197
|
expect {@registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"slateP", :type=>:multi_string, :data=>["Pink", "Delicate"]})}.to raise_error(Chef::Exceptions::Win32RegDataMissing)
|
186
198
|
end
|
@@ -33,7 +33,7 @@ end
|
|
33
33
|
# directories.
|
34
34
|
#
|
35
35
|
|
36
|
-
describe "Chef::Application::WindowsServiceManager", :windows_only, :system_windows_service_gem_only do
|
36
|
+
describe "Chef::Application::WindowsServiceManager", :windows_only, :system_windows_service_gem_only, :appveyor_only do
|
37
37
|
|
38
38
|
include_context "using Win32::Service"
|
39
39
|
|
@@ -43,7 +43,7 @@ describe "Chef::Application::WindowsServiceManager", :windows_only, :system_wind
|
|
43
43
|
end
|
44
44
|
|
45
45
|
it "throws an error with required missing options" do
|
46
|
-
|
46
|
+
[:service_name, :service_display_name, :service_description, :service_file_path].each do |key|
|
47
47
|
service_def = test_service.dup
|
48
48
|
service_def.delete(key)
|
49
49
|
|
@@ -24,6 +24,8 @@ describe 'chef_repo_path tests', :workstation do
|
|
24
24
|
include IntegrationSupport
|
25
25
|
include KnifeSupport
|
26
26
|
|
27
|
+
let(:error_rel_path_outside_repo) { /^ERROR: Attempt to use relative path '' when current directory is outside the repository path/ }
|
28
|
+
|
27
29
|
# TODO alternate repo_path / *_path
|
28
30
|
context 'alternate *_path' do
|
29
31
|
when_the_repository 'has clients and clients2, cookbooks and cookbooks2, etc.' do
|
@@ -109,14 +111,14 @@ EOM
|
|
109
111
|
context 'when cwd is at the top level' do
|
110
112
|
before { cwd '.' }
|
111
113
|
it 'knife list --local -Rfp fails' do
|
112
|
-
knife('list --local -Rfp').should_fail(
|
114
|
+
knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
|
113
115
|
end
|
114
116
|
end
|
115
117
|
|
116
118
|
context 'when cwd is inside the data_bags directory' do
|
117
119
|
before { cwd 'data_bags' }
|
118
120
|
it 'knife list --local -Rfp fails' do
|
119
|
-
knife('list --local -Rfp').should_fail(
|
121
|
+
knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
|
120
122
|
end
|
121
123
|
end
|
122
124
|
|
@@ -192,14 +194,14 @@ EOM
|
|
192
194
|
context 'when cwd is inside the data_bags directory' do
|
193
195
|
before { cwd 'data_bags' }
|
194
196
|
it 'knife list --local -Rfp fails' do
|
195
|
-
knife('list --local -Rfp').should_fail(
|
197
|
+
knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
|
196
198
|
end
|
197
199
|
end
|
198
200
|
|
199
201
|
context 'when cwd is inside chef_repo2' do
|
200
202
|
before { cwd 'chef_repo2' }
|
201
203
|
it 'knife list -Rfp fails' do
|
202
|
-
knife('list --local -Rfp').should_fail(
|
204
|
+
knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
|
203
205
|
end
|
204
206
|
end
|
205
207
|
|
@@ -225,14 +227,14 @@ EOM
|
|
225
227
|
context 'when cwd is at the top level' do
|
226
228
|
before { cwd '.' }
|
227
229
|
it 'knife list --local -Rfp fails' do
|
228
|
-
knife('list --local -Rfp').should_fail(
|
230
|
+
knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
|
229
231
|
end
|
230
232
|
end
|
231
233
|
|
232
234
|
context 'when cwd is inside the data_bags directory' do
|
233
235
|
before { cwd 'data_bags' }
|
234
236
|
it 'knife list --local -Rfp fails' do
|
235
|
-
knife('list --local -Rfp').should_fail(
|
237
|
+
knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
|
236
238
|
end
|
237
239
|
end
|
238
240
|
|
@@ -445,7 +447,7 @@ EOM
|
|
445
447
|
context 'when cwd is at the top level' do
|
446
448
|
before { cwd '.' }
|
447
449
|
it 'knife list --local -Rfp fails' do
|
448
|
-
knife('list --local -Rfp').should_fail(
|
450
|
+
knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
|
449
451
|
end
|
450
452
|
end
|
451
453
|
|
@@ -621,14 +623,14 @@ EOM
|
|
621
623
|
context 'when cwd is at the top level' do
|
622
624
|
before { cwd '.' }
|
623
625
|
it 'knife list --local -Rfp fails' do
|
624
|
-
knife('list --local -Rfp').should_fail(
|
626
|
+
knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
|
625
627
|
end
|
626
628
|
end
|
627
629
|
|
628
630
|
context 'when cwd is inside the data_bags directory' do
|
629
631
|
before { cwd 'data_bags' }
|
630
632
|
it 'knife list --local -Rfp fails' do
|
631
|
-
knife('list --local -Rfp').should_fail(
|
633
|
+
knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
|
632
634
|
end
|
633
635
|
end
|
634
636
|
|
@@ -782,7 +784,7 @@ EOM
|
|
782
784
|
context 'when cwd is at the top level' do
|
783
785
|
before { cwd '.' }
|
784
786
|
it 'knife list --local -Rfp fails' do
|
785
|
-
knife('list --local -Rfp').should_fail(
|
787
|
+
knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
|
786
788
|
end
|
787
789
|
end
|
788
790
|
|
@@ -823,7 +825,7 @@ EOM
|
|
823
825
|
context 'when cwd is inside chef_repo2/data_bags' do
|
824
826
|
before { cwd 'chef_repo2/data_bags' }
|
825
827
|
it 'knife list --local -Rfp fails' do
|
826
|
-
knife('list --local -Rfp').should_fail(
|
828
|
+
knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
|
827
829
|
end
|
828
830
|
end
|
829
831
|
end
|
@@ -794,21 +794,6 @@ describe "Recipe DSL methods" do
|
|
794
794
|
end
|
795
795
|
end
|
796
796
|
|
797
|
-
context "when Thingy9 provides :thingy9" do
|
798
|
-
before(:context) {
|
799
|
-
class RecipeDSLSpecNamespace::Thingy9 < BaseThingy
|
800
|
-
resource_name :thingy9
|
801
|
-
end
|
802
|
-
}
|
803
|
-
|
804
|
-
it "declaring a resource providing the same :thingy9 produces a warning" do
|
805
|
-
expect(Chef::Log).to receive(:warn).with("You declared a new resource RecipeDSLSpecNamespace::Thingy9AlternateProvider for resource thingy9, but it comes alphabetically after RecipeDSLSpecNamespace::Thingy9 and has the same filters ({}), so it will not be used. Use override: true if you want to use it for thingy9.")
|
806
|
-
class RecipeDSLSpecNamespace::Thingy9AlternateProvider < BaseThingy
|
807
|
-
resource_name :thingy9
|
808
|
-
end
|
809
|
-
end
|
810
|
-
end
|
811
|
-
|
812
797
|
context "when Thingy10 provides :thingy10" do
|
813
798
|
before(:context) {
|
814
799
|
class RecipeDSLSpecNamespace::Thingy10 < BaseThingy
|