chef 10.14.0.beta.1 → 10.14.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- data/distro/common/html/chef-client.8.html +3 -3
- data/distro/common/html/chef-expander.8.html +3 -3
- data/distro/common/html/chef-expanderctl.8.html +3 -3
- data/distro/common/html/chef-server-webui.8.html +3 -3
- data/distro/common/html/chef-server.8.html +3 -3
- data/distro/common/html/chef-solo.8.html +3 -3
- data/distro/common/html/chef-solr.8.html +3 -3
- data/distro/common/html/knife-bootstrap.1.html +3 -3
- data/distro/common/html/knife-client.1.html +3 -3
- data/distro/common/html/knife-configure.1.html +3 -3
- data/distro/common/html/knife-cookbook-site.1.html +3 -3
- data/distro/common/html/knife-cookbook.1.html +3 -3
- data/distro/common/html/knife-data-bag.1.html +3 -3
- data/distro/common/html/knife-environment.1.html +3 -3
- data/distro/common/html/knife-exec.1.html +3 -3
- data/distro/common/html/knife-index.1.html +4 -4
- data/distro/common/html/knife-node.1.html +3 -3
- data/distro/common/html/knife-role.1.html +3 -3
- data/distro/common/html/knife-search.1.html +5 -5
- data/distro/common/html/knife-ssh.1.html +4 -4
- data/distro/common/html/knife-status.1.html +4 -4
- data/distro/common/html/knife-tag.1.html +4 -4
- data/distro/common/html/knife.1.html +3 -3
- data/distro/common/html/shef.1.html +7 -7
- data/distro/common/man/man1/knife-bootstrap.1 +1 -1
- data/distro/common/man/man1/knife-client.1 +1 -1
- data/distro/common/man/man1/knife-configure.1 +1 -1
- data/distro/common/man/man1/knife-cookbook-site.1 +1 -1
- data/distro/common/man/man1/knife-cookbook.1 +1 -1
- data/distro/common/man/man1/knife-data-bag.1 +1 -1
- data/distro/common/man/man1/knife-environment.1 +1 -1
- data/distro/common/man/man1/knife-exec.1 +1 -1
- data/distro/common/man/man1/knife-index.1 +1 -1
- data/distro/common/man/man1/knife-node.1 +1 -1
- data/distro/common/man/man1/knife-role.1 +1 -1
- data/distro/common/man/man1/knife-search.1 +1 -1
- data/distro/common/man/man1/knife-ssh.1 +1 -1
- data/distro/common/man/man1/knife-status.1 +1 -1
- data/distro/common/man/man1/knife-tag.1 +1 -1
- data/distro/common/man/man1/knife.1 +1 -1
- data/distro/common/man/man1/shef.1 +1 -1
- data/distro/common/man/man8/chef-client.8 +1 -1
- data/distro/common/man/man8/chef-expander.8 +1 -1
- data/distro/common/man/man8/chef-expanderctl.8 +1 -1
- data/distro/common/man/man8/chef-server-webui.8 +1 -1
- data/distro/common/man/man8/chef-server.8 +1 -1
- data/distro/common/man/man8/chef-solo.8 +1 -1
- data/distro/common/man/man8/chef-solr.8 +1 -1
- data/lib/chef/event_dispatch/base.rb +4 -0
- data/lib/chef/formatters/base.rb +39 -56
- data/lib/chef/formatters/error_descriptor.rb +66 -0
- data/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb +2 -1
- data/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb +3 -2
- data/lib/chef/formatters/error_mapper.rb +78 -0
- data/lib/chef/mixin/language_include_recipe.rb +1 -0
- data/lib/chef/provider.rb +5 -0
- data/lib/chef/provider/package/rubygems.rb +10 -0
- data/lib/chef/resource.rb +68 -12
- data/lib/chef/resource_reporter.rb +40 -16
- data/lib/chef/run_context.rb +37 -1
- data/lib/chef/runner.rb +2 -2
- data/lib/chef/version.rb +1 -1
- data/spec/unit/provider/deploy/revision_spec.rb +3 -2
- data/spec/unit/resource_reporter_spec.rb +36 -18
- data/spec/unit/resource_spec.rb +98 -3
- metadata +6 -4
data/lib/chef/run_context.rb
CHANGED
@@ -35,7 +35,7 @@ class Chef
|
|
35
35
|
|
36
36
|
# Needs to be settable so deploy can run a resource_collection independent
|
37
37
|
# of any cookbooks.
|
38
|
-
attr_accessor :resource_collection
|
38
|
+
attr_accessor :resource_collection, :immediate_notification_collection, :delayed_notification_collection
|
39
39
|
|
40
40
|
attr_reader :events
|
41
41
|
|
@@ -48,6 +48,8 @@ class Chef
|
|
48
48
|
@node = node
|
49
49
|
@cookbook_collection = cookbook_collection
|
50
50
|
@resource_collection = Chef::ResourceCollection.new
|
51
|
+
@immediate_notification_collection = Hash.new {|h,k| h[k] = []}
|
52
|
+
@delayed_notification_collection = Hash.new {|h,k| h[k] = []}
|
51
53
|
@definitions = Hash.new
|
52
54
|
@events = events
|
53
55
|
|
@@ -90,6 +92,40 @@ class Chef
|
|
90
92
|
cookbook.recipe_filenames_by_name[recipe_short_name]
|
91
93
|
end
|
92
94
|
|
95
|
+
def notifies_immediately(notification)
|
96
|
+
nr = notification.notifying_resource
|
97
|
+
if nr.instance_of?(Chef::Resource)
|
98
|
+
@immediate_notification_collection[nr.name] << notification
|
99
|
+
else
|
100
|
+
@immediate_notification_collection[nr.to_s] << notification
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def notifies_delayed(notification)
|
105
|
+
nr = notification.notifying_resource
|
106
|
+
if nr.instance_of?(Chef::Resource)
|
107
|
+
@delayed_notification_collection[nr.name] << notification
|
108
|
+
else
|
109
|
+
@delayed_notification_collection[nr.to_s] << notification
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def immediate_notifications(resource)
|
114
|
+
if resource.instance_of?(Chef::Resource)
|
115
|
+
return @immediate_notification_collection[resource.name]
|
116
|
+
else
|
117
|
+
return @immediate_notification_collection[resource.to_s]
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def delayed_notifications(resource)
|
122
|
+
if resource.instance_of?(Chef::Resource)
|
123
|
+
return @delayed_notification_collection[resource.name]
|
124
|
+
else
|
125
|
+
return @delayed_notification_collection[resource.to_s]
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
93
129
|
private
|
94
130
|
|
95
131
|
def load_libraries
|
data/lib/chef/runner.rb
CHANGED
@@ -52,12 +52,12 @@ class Chef
|
|
52
52
|
# associated with the resource, but only if it was updated *this time*
|
53
53
|
# we ran an action on it.
|
54
54
|
if resource.updated_by_last_action?
|
55
|
-
|
55
|
+
run_context.immediate_notifications(resource).each do |notification|
|
56
56
|
Chef::Log.info("#{resource} sending #{notification.action} action to #{notification.resource} (immediate)")
|
57
57
|
run_action(notification.resource, notification.action, :immediate, resource)
|
58
58
|
end
|
59
59
|
|
60
|
-
|
60
|
+
run_context.delayed_notifications(resource).each do |notification|
|
61
61
|
if delayed_actions.any? { |existing_notification| existing_notification.duplicates?(notification) }
|
62
62
|
Chef::Log.info( "#{resource} not queuing delayed action #{notification.action} on #{notification.resource}"\
|
63
63
|
" (delayed), as it's already been queued")
|
data/lib/chef/version.rb
CHANGED
@@ -21,7 +21,8 @@ require 'spec_helper'
|
|
21
21
|
describe Chef::Provider::Deploy::Revision do
|
22
22
|
|
23
23
|
before do
|
24
|
-
|
24
|
+
@temp_dir = Dir.mktmpdir
|
25
|
+
Chef::Config[:file_cache_path] = @temp_dir
|
25
26
|
@resource = Chef::Resource::Deploy.new("/my/deploy/dir")
|
26
27
|
@resource.revision("8a3195bf3efa246f743c5dfa83683201880f935c")
|
27
28
|
@node = Chef::Node.new
|
@@ -37,7 +38,7 @@ describe Chef::Provider::Deploy::Revision do
|
|
37
38
|
after do
|
38
39
|
# Make sure we don't keep any state in our tests
|
39
40
|
FileUtils.rspec_reset
|
40
|
-
FileUtils.rm_rf
|
41
|
+
FileUtils.rm_rf @temp_dir if File.directory?( @temp_dir )
|
41
42
|
end
|
42
43
|
|
43
44
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Daniel DeLeo (<dan@opscode.com>)
|
3
|
-
# Author:: Prajakta Purohit (prajakta@opscode.com>)
|
3
|
+
# Author:: Prajakta Purohit (<prajakta@opscode.com>)
|
4
|
+
# Author:: Tyler Cloke (<tyler@opscode.com>)
|
4
5
|
#
|
5
6
|
# Copyright:: Copyright (c) 2012 Opscode, Inc.
|
6
7
|
# License:: Apache License, Version 2.0
|
@@ -47,6 +48,12 @@ describe Chef::ResourceReporter do
|
|
47
48
|
@resource_reporter.reporting_enabled?.should be_true
|
48
49
|
end
|
49
50
|
|
51
|
+
it "should have no error_descriptions" do
|
52
|
+
@resource_reporter.error_descriptions.should be_nil
|
53
|
+
# @resource_reporter.error_descriptions.should be_empty
|
54
|
+
# @resource_reporter.should have(0).error_descriptions
|
55
|
+
end
|
56
|
+
|
50
57
|
end
|
51
58
|
|
52
59
|
context "after the chef run completes" do
|
@@ -65,8 +72,8 @@ describe Chef::ResourceReporter do
|
|
65
72
|
@resource_reporter.run_failed(@exception)
|
66
73
|
end
|
67
74
|
|
68
|
-
it "sets the run status to '
|
69
|
-
@resource_reporter.status.should == "
|
75
|
+
it "sets the run status to 'failure'" do
|
76
|
+
@resource_reporter.status.should == "failure"
|
70
77
|
end
|
71
78
|
|
72
79
|
it "keeps the exception data" do
|
@@ -80,6 +87,7 @@ describe Chef::ResourceReporter do
|
|
80
87
|
@exception = Exception.new
|
81
88
|
@resource_reporter.resource_action_start(@new_resource, :create)
|
82
89
|
@resource_reporter.resource_failed(@new_resource, :create, @exception)
|
90
|
+
@resource_reporter.resource_completed(@new_resource)
|
83
91
|
end
|
84
92
|
|
85
93
|
it "collects the resource as an updated resource" do
|
@@ -89,8 +97,8 @@ describe Chef::ResourceReporter do
|
|
89
97
|
it "collects the desired state of the resource" do
|
90
98
|
update_record = @resource_reporter.updated_resources.first
|
91
99
|
update_record.new_resource.should == @new_resource
|
92
|
-
end
|
93
100
|
|
101
|
+
end
|
94
102
|
end
|
95
103
|
|
96
104
|
# TODO: make sure a resource that is skipped because of `not_if` doesn't
|
@@ -117,6 +125,7 @@ describe Chef::ResourceReporter do
|
|
117
125
|
@new_resource.content("this is the old content")
|
118
126
|
@current_resource.content("this is the new hotness")
|
119
127
|
@resource_reporter.resource_updated(@new_resource, :create)
|
128
|
+
@resource_reporter.resource_completed(@new_resource)
|
120
129
|
end
|
121
130
|
|
122
131
|
it "collects the updated resource" do
|
@@ -140,6 +149,7 @@ describe Chef::ResourceReporter do
|
|
140
149
|
@next_new_resource = Chef::Resource::Service.new("apache2")
|
141
150
|
@exception = Exception.new
|
142
151
|
@resource_reporter.resource_failed(@next_new_resource, :create, @exception)
|
152
|
+
@resource_reporter.resource_completed(@next_new_resource)
|
143
153
|
end
|
144
154
|
|
145
155
|
it "collects the desired state of the failed resource" do
|
@@ -164,7 +174,9 @@ describe Chef::ResourceReporter do
|
|
164
174
|
@resource_reporter.resource_action_start(@implementation_resource , :create)
|
165
175
|
@resource_reporter.resource_current_state_loaded(@implementation_resource, :create, @implementation_resource)
|
166
176
|
@resource_reporter.resource_updated(@implementation_resource, :create)
|
177
|
+
@resource_reporter.resource_completed(@implementation_resource)
|
167
178
|
@resource_reporter.resource_updated(@new_resource, :create)
|
179
|
+
@resource_reporter.resource_completed(@new_resource)
|
168
180
|
end
|
169
181
|
|
170
182
|
it "does not collect data about the nested resource" do
|
@@ -178,7 +190,9 @@ describe Chef::ResourceReporter do
|
|
178
190
|
@resource_reporter.resource_action_start(@implementation_resource , :create)
|
179
191
|
@resource_reporter.resource_current_state_loaded(@implementation_resource, :create, @implementation_resource)
|
180
192
|
@resource_reporter.resource_up_to_date(@implementation_resource, :create)
|
193
|
+
@resource_reporter.resource_completed(@implementation_resource)
|
181
194
|
@resource_reporter.resource_updated(@new_resource, :create)
|
195
|
+
@resource_reporter.resource_completed(@new_resource)
|
182
196
|
end
|
183
197
|
|
184
198
|
it "does not collect data about the nested resource" do
|
@@ -190,6 +204,7 @@ describe Chef::ResourceReporter do
|
|
190
204
|
before do
|
191
205
|
@exception = Exception.new
|
192
206
|
@resource_reporter.resource_failed(@new_resource, :create, @exception)
|
207
|
+
@resource_reporter.resource_completed(@new_resource)
|
193
208
|
end
|
194
209
|
|
195
210
|
it "collects the resource as an updated resource" do
|
@@ -249,6 +264,7 @@ describe Chef::ResourceReporter do
|
|
249
264
|
@resource_reporter.resource_action_start(@new_resource, :create)
|
250
265
|
@resource_reporter.resource_current_state_loaded(@new_resource, :create, @current_resource)
|
251
266
|
@resource_reporter.resource_updated(@new_resource, :create)
|
267
|
+
@resource_reporter.resource_completed(@new_resource)
|
252
268
|
@report = @resource_reporter.report(@node)
|
253
269
|
@first_update_report = @report["resources"].first
|
254
270
|
end
|
@@ -322,40 +338,42 @@ describe Chef::ResourceReporter do
|
|
322
338
|
context "for an unsuccessful run" do
|
323
339
|
|
324
340
|
before do
|
341
|
+
|
325
342
|
@backtrace = "foo.rb:1 in `foo!'\nbar.rb:2 in `bar!\n'baz.rb:3 in `baz!'"
|
326
343
|
@node = Chef::Node.new
|
327
344
|
@node.name("spitfire")
|
328
345
|
@exception = mock("ArgumentError")
|
329
|
-
@exception.
|
330
|
-
@exception.
|
331
|
-
@exception.
|
346
|
+
@exception.stub!(:inspect).and_return("Net::HTTPServerException")
|
347
|
+
@exception.stub!(:message).and_return("Object not found")
|
348
|
+
@exception.stub!(:backtrace).and_return(@backtrace)
|
332
349
|
@resource_reporter.run_failed(@exception)
|
350
|
+
@resource_reporter.run_list_expand_failed(@node, @exception)
|
333
351
|
@report = @resource_reporter.report(@node)
|
334
352
|
end
|
335
353
|
|
336
354
|
it "includes the exception type in the event data" do
|
337
|
-
@report.should have_key("
|
338
|
-
@report["
|
339
|
-
@report["
|
355
|
+
@report.should have_key("data")
|
356
|
+
@report["data"].should have_key("exception")
|
357
|
+
@report["data"]["exception"].should have_key("class")
|
358
|
+
@report["data"]["exception"]["class"].should == "Net::HTTPServerException"
|
340
359
|
end
|
341
360
|
|
342
361
|
it "includes the exception message in the event data" do
|
343
|
-
@report.should have_key("
|
344
|
-
@report["exception"].should
|
345
|
-
@report["exception"]["message"].should == "Object not found"
|
362
|
+
@report["data"]["exception"].should have_key("message")
|
363
|
+
@report["data"]["exception"]["message"].should == "Object not found"
|
346
364
|
end
|
347
365
|
|
348
366
|
it "includes the exception trace in the event data" do
|
349
|
-
@report.should have_key("
|
350
|
-
@report["exception"].should
|
351
|
-
@report["exception"]["backtrace"].should == @backtrace
|
367
|
+
@report["data"]["exception"].should have_key("backtrace")
|
368
|
+
@report["data"]["exception"]["backtrace"].should == @backtrace
|
352
369
|
end
|
353
370
|
|
354
371
|
it "includes the error inspector output in the event data" do
|
355
|
-
@report.should have_key("
|
356
|
-
@report["exception"].should
|
372
|
+
@report["data"]["exception"].should have_key("description")
|
373
|
+
@report["data"]["exception"]["description"].should include({"title"=>"Error expanding the run_list:", "sections"=>[["Unexpected Error:", "RSpec::Mocks::Mock: Object not found"]]})
|
357
374
|
end
|
358
375
|
|
376
|
+
|
359
377
|
end
|
360
378
|
|
361
379
|
end
|
data/spec/unit/resource_spec.rb
CHANGED
@@ -304,9 +304,9 @@ describe Chef::Resource do
|
|
304
304
|
it "should convert to a hash" do
|
305
305
|
hash = @resource.to_hash
|
306
306
|
expected_keys = [ :allowed_actions, :params, :provider, :updated,
|
307
|
-
:updated_by_last_action, :before, :supports,
|
308
|
-
:
|
309
|
-
:action, :retries, :retry_delay
|
307
|
+
:updated_by_last_action, :before, :supports,
|
308
|
+
:noop, :ignore_failure, :name, :source_line,
|
309
|
+
:action, :retries, :retry_delay, :elapsed_time]
|
310
310
|
(hash.keys - expected_keys).should == []
|
311
311
|
(expected_keys - hash.keys).should == []
|
312
312
|
hash[:name].should eql("funk")
|
@@ -593,6 +593,8 @@ describe Chef::Resource::Notification do
|
|
593
593
|
it "takes no action to resolve a resource reference that doesn't need to be resolved" do
|
594
594
|
@keyboard_cat = Chef::Resource::Cat.new("keyboard_cat")
|
595
595
|
@notification.resource = @keyboard_cat
|
596
|
+
@long_cat = Chef::Resource::Cat.new("long_cat")
|
597
|
+
@notification.notifying_resource = @long_cat
|
596
598
|
@resource_collection = Chef::ResourceCollection.new
|
597
599
|
# would raise an error since the resource is not in the collection
|
598
600
|
@notification.resolve_resource_reference(@resource_collection)
|
@@ -604,8 +606,101 @@ describe Chef::Resource::Notification do
|
|
604
606
|
@keyboard_cat = Chef::Resource::Cat.new("keyboard_cat")
|
605
607
|
@resource_collection = Chef::ResourceCollection.new
|
606
608
|
@resource_collection << @keyboard_cat
|
609
|
+
@long_cat = Chef::Resource::Cat.new("long_cat")
|
610
|
+
@notification.notifying_resource = @long_cat
|
607
611
|
@notification.resolve_resource_reference(@resource_collection)
|
608
612
|
@notification.resource.should == @keyboard_cat
|
609
613
|
end
|
610
614
|
|
615
|
+
it "resolves a lazy reference to its notifying resource" do
|
616
|
+
@keyboard_cat = Chef::Resource::Cat.new("keyboard_cat")
|
617
|
+
@notification.resource = @keyboard_cat
|
618
|
+
@notification.notifying_resource = {:cat => "long_cat"}
|
619
|
+
@long_cat = Chef::Resource::Cat.new("long_cat")
|
620
|
+
@resource_collection = Chef::ResourceCollection.new
|
621
|
+
@resource_collection << @long_cat
|
622
|
+
@notification.resolve_resource_reference(@resource_collection)
|
623
|
+
@notification.notifying_resource.should == @long_cat
|
624
|
+
end
|
625
|
+
|
626
|
+
it "resolves lazy references to both its resource and its notifying resource" do
|
627
|
+
@notification.resource = {:cat => "keyboard_cat"}
|
628
|
+
@keyboard_cat = Chef::Resource::Cat.new("keyboard_cat")
|
629
|
+
@resource_collection = Chef::ResourceCollection.new
|
630
|
+
@resource_collection << @keyboard_cat
|
631
|
+
@notification.notifying_resource = {:cat => "long_cat"}
|
632
|
+
@long_cat = Chef::Resource::Cat.new("long_cat")
|
633
|
+
@resource_collection << @long_cat
|
634
|
+
@notification.resolve_resource_reference(@resource_collection)
|
635
|
+
@notification.resource.should == @keyboard_cat
|
636
|
+
@notification.notifying_resource.should == @long_cat
|
637
|
+
end
|
638
|
+
|
639
|
+
it "raises a RuntimeError if you try to reference multiple resources" do
|
640
|
+
@notification.resource = {:cat => ["keyboard_cat", "cheez_cat"]}
|
641
|
+
@keyboard_cat = Chef::Resource::Cat.new("keyboard_cat")
|
642
|
+
@cheez_cat = Chef::Resource::Cat.new("cheez_cat")
|
643
|
+
@resource_collection = Chef::ResourceCollection.new
|
644
|
+
@resource_collection << @keyboard_cat
|
645
|
+
@resource_collection << @cheez_cat
|
646
|
+
@long_cat = Chef::Resource::Cat.new("long_cat")
|
647
|
+
@notification.notifying_resource = @long_cat
|
648
|
+
lambda {@notification.resolve_resource_reference(@resource_collection)}.should raise_error(RuntimeError)
|
649
|
+
end
|
650
|
+
|
651
|
+
it "raises a RuntimeError if you try to reference multiple notifying resources" do
|
652
|
+
@notification.notifying_resource = {:cat => ["long_cat", "cheez_cat"]}
|
653
|
+
@long_cat = Chef::Resource::Cat.new("long_cat")
|
654
|
+
@cheez_cat = Chef::Resource::Cat.new("cheez_cat")
|
655
|
+
@resource_collection = Chef::ResourceCollection.new
|
656
|
+
@resource_collection << @long_cat
|
657
|
+
@resource_collection << @cheez_cat
|
658
|
+
@keyboard_cat = Chef::Resource::Cat.new("keyboard_cat")
|
659
|
+
@notification.resource = @keyboard_cat
|
660
|
+
lambda {@notification.resolve_resource_reference(@resource_collection)}.should raise_error(RuntimeError)
|
661
|
+
end
|
662
|
+
|
663
|
+
it "raises a RuntimeError if it can't find a resource in the resource collection when resolving a lazy reference" do
|
664
|
+
@notification.resource = {:cat => "keyboard_cat"}
|
665
|
+
@cheez_cat = Chef::Resource::Cat.new("cheez_cat")
|
666
|
+
@resource_collection = Chef::ResourceCollection.new
|
667
|
+
@resource_collection << @cheez_cat
|
668
|
+
@long_cat = Chef::Resource::Cat.new("long_cat")
|
669
|
+
@notification.notifying_resource = @long_cat
|
670
|
+
lambda {@notification.resolve_resource_reference(@resource_collection)}.should raise_error(RuntimeError)
|
671
|
+
end
|
672
|
+
|
673
|
+
it "raises a RuntimeError if it can't find a notifying resource in the resource collection when resolving a lazy reference" do
|
674
|
+
@notification.notifying_resource = {:cat => "long_cat"}
|
675
|
+
@cheez_cat = Chef::Resource::Cat.new("cheez_cat")
|
676
|
+
@resource_collection = Chef::ResourceCollection.new
|
677
|
+
@resource_collection << @cheez_cat
|
678
|
+
@keyboard_cat = Chef::Resource::Cat.new("keyboard_cat")
|
679
|
+
@notification.resource = @keyboard_cat
|
680
|
+
lambda {@notification.resolve_resource_reference(@resource_collection)}.should raise_error(RuntimeError)
|
681
|
+
end
|
682
|
+
|
683
|
+
it "raises an ArgumentError if improper syntax is used in the lazy reference to its resource" do
|
684
|
+
@notification.resource = "cat => keyboard_cat"
|
685
|
+
@keyboard_cat = Chef::Resource::Cat.new("keyboard_cat")
|
686
|
+
@resource_collection = Chef::ResourceCollection.new
|
687
|
+
@resource_collection << @keyboard_cat
|
688
|
+
@long_cat = Chef::Resource::Cat.new("long_cat")
|
689
|
+
@notification.notifying_resource = @long_cat
|
690
|
+
lambda {@notification.resolve_resource_reference(@resource_collection)}.should raise_error(ArgumentError)
|
691
|
+
end
|
692
|
+
|
693
|
+
it "raises an ArgumentError if improper syntax is used in the lazy reference to its notifying resource" do
|
694
|
+
@notification.notifying_resource = "cat => long_cat"
|
695
|
+
@long_cat = Chef::Resource::Cat.new("long_cat")
|
696
|
+
@resource_collection = Chef::ResourceCollection.new
|
697
|
+
@resource_collection << @long_cat
|
698
|
+
@keyboard_cat = Chef::Resource::Cat.new("keyboard_cat")
|
699
|
+
@notification.resource = @keyboard_cat
|
700
|
+
lambda {@notification.resolve_resource_reference(@resource_collection)}.should raise_error(ArgumentError)
|
701
|
+
end
|
702
|
+
|
703
|
+
# Create test to resolve lazy references to both notifying resource and dest. resource
|
704
|
+
# Create tests to check proper error raising
|
705
|
+
|
611
706
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: -1445976474
|
5
5
|
prerelease: 8
|
6
6
|
segments:
|
7
7
|
- 10
|
8
8
|
- 14
|
9
9
|
- 0
|
10
10
|
- beta
|
11
|
-
-
|
12
|
-
version: 10.14.0.beta.
|
11
|
+
- 2
|
12
|
+
version: 10.14.0.beta.2
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Adam Jacob
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2012-07-
|
20
|
+
date: 2012-07-12 00:00:00 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: mixlib-config
|
@@ -625,6 +625,8 @@ files:
|
|
625
625
|
- lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb
|
626
626
|
- lib/chef/formatters/error_inspectors/compile_error_inspector.rb
|
627
627
|
- lib/chef/formatters/error_inspectors/node_load_error_inspector.rb
|
628
|
+
- lib/chef/formatters/error_mapper.rb
|
629
|
+
- lib/chef/formatters/error_descriptor.rb
|
628
630
|
- lib/chef/formatters/error_inspectors.rb
|
629
631
|
- lib/chef/run_list/run_list_item.rb
|
630
632
|
- lib/chef/run_list/versioned_recipe_list.rb
|