chefspec 2.0.1 → 3.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/lib/chefspec.rb +30 -44
  3. data/lib/chefspec/api.rb +74 -0
  4. data/lib/chefspec/api/apt_package.rb +192 -0
  5. data/lib/chefspec/api/batch.rb +43 -0
  6. data/lib/chefspec/api/chef_gem.rb +191 -0
  7. data/lib/chefspec/api/cookbook_file.rb +166 -0
  8. data/lib/chefspec/api/cron.rb +80 -0
  9. data/lib/chefspec/api/deploy.rb +117 -0
  10. data/lib/chefspec/api/directory.rb +80 -0
  11. data/lib/chefspec/api/dpkg_package.rb +117 -0
  12. data/lib/chefspec/api/easy_install_package.rb +154 -0
  13. data/lib/chefspec/api/env.rb +117 -0
  14. data/lib/chefspec/api/erl_call.rb +43 -0
  15. data/lib/chefspec/api/execute.rb +43 -0
  16. data/lib/chefspec/api/file.rb +166 -0
  17. data/lib/chefspec/api/freebsd_package.rb +80 -0
  18. data/lib/chefspec/api/gem_package.rb +191 -0
  19. data/lib/chefspec/api/git.rb +117 -0
  20. data/lib/chefspec/api/group.rb +154 -0
  21. data/lib/chefspec/api/http_request.rb +228 -0
  22. data/lib/chefspec/api/ifconfig.rb +154 -0
  23. data/lib/chefspec/api/include_recipe.rb +26 -0
  24. data/lib/chefspec/api/ips_package.rb +117 -0
  25. data/lib/chefspec/api/link.rb +102 -0
  26. data/lib/chefspec/api/log.rb +43 -0
  27. data/lib/chefspec/api/macports_package.rb +154 -0
  28. data/lib/chefspec/api/mdadm.rb +117 -0
  29. data/lib/chefspec/api/mount.rb +192 -0
  30. data/lib/chefspec/api/notifications.rb +38 -0
  31. data/lib/chefspec/api/ohai.rb +43 -0
  32. data/lib/chefspec/api/package.rb +192 -0
  33. data/lib/chefspec/api/pacman_package.rb +155 -0
  34. data/lib/chefspec/api/portage_package.rb +155 -0
  35. data/lib/chefspec/api/powershell_script.rb +43 -0
  36. data/lib/chefspec/api/registry_key.rb +166 -0
  37. data/lib/chefspec/api/remote_directory.rb +120 -0
  38. data/lib/chefspec/api/remote_file.rb +166 -0
  39. data/lib/chefspec/api/render_file.rb +32 -0
  40. data/lib/chefspec/api/route.rb +80 -0
  41. data/lib/chefspec/api/rpm_package.rb +117 -0
  42. data/lib/chefspec/api/ruby_block.rb +37 -0
  43. data/lib/chefspec/api/script.rb +228 -0
  44. data/lib/chefspec/api/service.rb +246 -0
  45. data/lib/chefspec/api/smartos_package.rb +117 -0
  46. data/lib/chefspec/api/solaris_package.rb +80 -0
  47. data/lib/chefspec/api/subversion.rb +154 -0
  48. data/lib/chefspec/api/template.rb +166 -0
  49. data/lib/chefspec/api/user.rb +228 -0
  50. data/lib/chefspec/api/yum_package.rb +154 -0
  51. data/lib/chefspec/berkshelf.rb +37 -0
  52. data/lib/chefspec/deprecations.rb +151 -0
  53. data/lib/chefspec/errors.rb +99 -0
  54. data/lib/chefspec/expect_exception.rb +45 -0
  55. data/lib/chefspec/extensions/chef/client.rb +15 -0
  56. data/lib/chefspec/extensions/chef/conditional.rb +11 -0
  57. data/lib/chefspec/extensions/chef/data_query.rb +29 -0
  58. data/lib/chefspec/extensions/chef/lwrp_base.rb +44 -0
  59. data/lib/chefspec/extensions/chef/resource.rb +27 -0
  60. data/lib/chefspec/extensions/chef/securable.rb +19 -0
  61. data/lib/chefspec/formatter.rb +270 -0
  62. data/lib/chefspec/macros.rb +217 -0
  63. data/lib/chefspec/matchers.rb +9 -0
  64. data/lib/chefspec/matchers/include_recipe_matcher.rb +45 -0
  65. data/lib/chefspec/matchers/link_to_matcher.rb +28 -0
  66. data/lib/chefspec/matchers/notifications_matcher.rb +92 -0
  67. data/lib/chefspec/matchers/render_file_matcher.rb +72 -0
  68. data/lib/chefspec/matchers/resource_matcher.rb +143 -0
  69. data/lib/chefspec/renderer.rb +137 -0
  70. data/lib/chefspec/rspec.rb +17 -0
  71. data/lib/chefspec/runner.rb +274 -0
  72. data/lib/chefspec/stubs/command_registry.rb +11 -0
  73. data/lib/chefspec/stubs/command_stub.rb +37 -0
  74. data/lib/chefspec/stubs/data_bag_item_registry.rb +13 -0
  75. data/lib/chefspec/stubs/data_bag_item_stub.rb +25 -0
  76. data/lib/chefspec/stubs/data_bag_registry.rb +13 -0
  77. data/lib/chefspec/stubs/data_bag_stub.rb +23 -0
  78. data/lib/chefspec/stubs/registry.rb +32 -0
  79. data/lib/chefspec/stubs/search_registry.rb +13 -0
  80. data/lib/chefspec/stubs/search_stub.rb +25 -0
  81. data/lib/chefspec/stubs/stub.rb +37 -0
  82. data/lib/chefspec/version.rb +1 -2
  83. metadata +100 -103
  84. data/lib/chef/expect_exception.rb +0 -34
  85. data/lib/chef/formatters/chefspec.rb +0 -233
  86. data/lib/chef/knife/cookbook_create_specs.rb +0 -107
  87. data/lib/chefspec/chef_runner.rb +0 -275
  88. data/lib/chefspec/helpers/describe.rb +0 -17
  89. data/lib/chefspec/matchers/cron.rb +0 -7
  90. data/lib/chefspec/matchers/env.rb +0 -8
  91. data/lib/chefspec/matchers/execute.rb +0 -33
  92. data/lib/chefspec/matchers/file.rb +0 -83
  93. data/lib/chefspec/matchers/file_content.rb +0 -32
  94. data/lib/chefspec/matchers/group.rb +0 -8
  95. data/lib/chefspec/matchers/include_recipe.rb +0 -20
  96. data/lib/chefspec/matchers/link.rb +0 -14
  97. data/lib/chefspec/matchers/log.rb +0 -21
  98. data/lib/chefspec/matchers/notifications.rb +0 -43
  99. data/lib/chefspec/matchers/package.rb +0 -39
  100. data/lib/chefspec/matchers/python.rb +0 -7
  101. data/lib/chefspec/matchers/ruby_block.rb +0 -13
  102. data/lib/chefspec/matchers/script.rb +0 -34
  103. data/lib/chefspec/matchers/service.rb +0 -25
  104. data/lib/chefspec/matchers/shared.rb +0 -132
  105. data/lib/chefspec/matchers/user.rb +0 -8
  106. data/lib/chefspec/minitest.rb +0 -195
  107. data/lib/chefspec/monkey_patches/conditional.rb +0 -19
  108. data/lib/chefspec/monkey_patches/hash.rb +0 -23
  109. data/lib/chefspec/monkey_patches/lwrp_base.rb +0 -45
  110. data/lib/chefspec/monkey_patches/provider.rb +0 -43
@@ -0,0 +1,13 @@
1
+ require_relative 'registry'
2
+
3
+ module ChefSpec
4
+ module Stubs
5
+ class SearchRegistry < Registry
6
+ def stub_for(type, query = '*:*')
7
+ @stubs.find do |stub|
8
+ stub.type.to_s == type.to_s && stub.query === query
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,25 @@
1
+ require_relative 'stub'
2
+
3
+ module ChefSpec
4
+ module Stubs
5
+ class SearchStub < Stub
6
+ attr_reader :block
7
+ attr_reader :query
8
+ attr_reader :type
9
+
10
+ def initialize(type, query = '*:*', &block)
11
+ @type = type.to_s
12
+ @query = query
13
+ @block = block
14
+ end
15
+
16
+ def signature
17
+ if @block
18
+ "stub_search(#{@type.inspect}, #{@query.inspect}) { # Ruby code }"
19
+ else
20
+ "stub_search(#{@type.inspect}, #{@query.inspect}).and_return(#{@value})"
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,37 @@
1
+ module ChefSpec
2
+ module Stubs
3
+ class Stub
4
+ attr_reader :value
5
+
6
+ def and_return(value)
7
+ @value = value
8
+ self
9
+ end
10
+
11
+ def and_raise(exception)
12
+ @block = Proc.new { raise exception }
13
+ self
14
+ end
15
+
16
+ def result
17
+ if @block
18
+ recursively_mashify(@block.call)
19
+ else
20
+ recursively_mashify(@value)
21
+ end
22
+ end
23
+
24
+ private
25
+ def recursively_mashify(thing)
26
+ case thing
27
+ when Array
28
+ thing.collect { |item| recursively_mashify(item) }
29
+ when Hash
30
+ Mash.from_hash(thing)
31
+ else
32
+ thing
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -1,4 +1,3 @@
1
1
  module ChefSpec
2
- # The gem version
3
- VERSION = '2.0.1'
2
+ VERSION = '3.0.0.beta.1'
4
3
  end
metadata CHANGED
@@ -1,43 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chefspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 3.0.0.beta.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Crump
8
+ - Seth Vargo
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-08-28 00:00:00.000000000 Z
12
+ date: 2013-10-10 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: chef
15
16
  requirement: !ruby/object:Gem::Requirement
16
17
  requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: '10.0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '>='
25
- - !ruby/object:Gem::Version
26
- version: '10.0'
27
- - !ruby/object:Gem::Dependency
28
- name: erubis
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '>='
18
+ - - ~>
32
19
  - !ruby/object:Gem::Version
33
- version: '0'
20
+ version: '11.0'
34
21
  type: :runtime
35
22
  prerelease: false
36
23
  version_requirements: !ruby/object:Gem::Requirement
37
24
  requirements:
38
- - - '>='
25
+ - - ~>
39
26
  - !ruby/object:Gem::Version
40
- version: '0'
27
+ version: '11.0'
41
28
  - !ruby/object:Gem::Dependency
42
29
  name: fauxhai
43
30
  requirement: !ruby/object:Gem::Requirement
@@ -52,34 +39,20 @@ dependencies:
52
39
  - - ~>
53
40
  - !ruby/object:Gem::Version
54
41
  version: '1.1'
55
- - !ruby/object:Gem::Dependency
56
- name: minitest-chef-handler
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - '>='
60
- - !ruby/object:Gem::Version
61
- version: 0.6.0
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - '>='
67
- - !ruby/object:Gem::Version
68
- version: 0.6.0
69
42
  - !ruby/object:Gem::Dependency
70
43
  name: rspec
71
44
  requirement: !ruby/object:Gem::Requirement
72
45
  requirements:
73
46
  - - ~>
74
47
  - !ruby/object:Gem::Version
75
- version: '2.0'
48
+ version: '2.14'
76
49
  type: :runtime
77
50
  prerelease: false
78
51
  version_requirements: !ruby/object:Gem::Requirement
79
52
  requirements:
80
53
  - - ~>
81
54
  - !ruby/object:Gem::Version
82
- version: '2.0'
55
+ version: '2.14'
83
56
  - !ruby/object:Gem::Dependency
84
57
  name: rake
85
58
  requirement: !ruby/object:Gem::Requirement
@@ -95,108 +68,132 @@ dependencies:
95
68
  - !ruby/object:Gem::Version
96
69
  version: '0'
97
70
  - !ruby/object:Gem::Dependency
98
- name: yard
71
+ name: redcarpet
99
72
  requirement: !ruby/object:Gem::Requirement
100
73
  requirements:
101
74
  - - ~>
102
75
  - !ruby/object:Gem::Version
103
- version: '0.8'
76
+ version: '3.0'
104
77
  type: :development
105
78
  prerelease: false
106
79
  version_requirements: !ruby/object:Gem::Requirement
107
80
  requirements:
108
81
  - - ~>
109
82
  - !ruby/object:Gem::Version
110
- version: '0.8'
83
+ version: '3.0'
111
84
  - !ruby/object:Gem::Dependency
112
- name: aruba
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ~>
116
- - !ruby/object:Gem::Version
117
- version: '0.5'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ~>
123
- - !ruby/object:Gem::Version
124
- version: '0.5'
125
- - !ruby/object:Gem::Dependency
126
- name: cucumber
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ~>
130
- - !ruby/object:Gem::Version
131
- version: '1.3'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ~>
137
- - !ruby/object:Gem::Version
138
- version: '1.3'
139
- - !ruby/object:Gem::Dependency
140
- name: i18n
85
+ name: yard
141
86
  requirement: !ruby/object:Gem::Requirement
142
87
  requirements:
143
88
  - - ~>
144
89
  - !ruby/object:Gem::Version
145
- version: '0.6'
90
+ version: '0.8'
146
91
  type: :development
147
92
  prerelease: false
148
93
  version_requirements: !ruby/object:Gem::Requirement
149
94
  requirements:
150
95
  - - ~>
151
96
  - !ruby/object:Gem::Version
152
- version: '0.6'
97
+ version: '0.8'
153
98
  - !ruby/object:Gem::Dependency
154
- name: simplecov
99
+ name: aruba
155
100
  requirement: !ruby/object:Gem::Requirement
156
101
  requirements:
157
102
  - - ~>
158
103
  - !ruby/object:Gem::Version
159
- version: '0.7'
104
+ version: '0.5'
160
105
  type: :development
161
106
  prerelease: false
162
107
  version_requirements: !ruby/object:Gem::Requirement
163
108
  requirements:
164
109
  - - ~>
165
110
  - !ruby/object:Gem::Version
166
- version: '0.7'
111
+ version: '0.5'
167
112
  description: Write RSpec examples for Opscode Chef recipes
168
113
  email:
169
114
  executables: []
170
115
  extensions: []
171
116
  extra_rdoc_files: []
172
117
  files:
173
- - lib/chef/expect_exception.rb
174
- - lib/chef/formatters/chefspec.rb
175
- - lib/chef/knife/cookbook_create_specs.rb
176
- - lib/chefspec/chef_runner.rb
177
- - lib/chefspec/helpers/describe.rb
178
- - lib/chefspec/matchers/cron.rb
179
- - lib/chefspec/matchers/env.rb
180
- - lib/chefspec/matchers/execute.rb
181
- - lib/chefspec/matchers/file.rb
182
- - lib/chefspec/matchers/file_content.rb
183
- - lib/chefspec/matchers/group.rb
184
- - lib/chefspec/matchers/include_recipe.rb
185
- - lib/chefspec/matchers/link.rb
186
- - lib/chefspec/matchers/log.rb
187
- - lib/chefspec/matchers/notifications.rb
188
- - lib/chefspec/matchers/package.rb
189
- - lib/chefspec/matchers/python.rb
190
- - lib/chefspec/matchers/ruby_block.rb
191
- - lib/chefspec/matchers/script.rb
192
- - lib/chefspec/matchers/service.rb
193
- - lib/chefspec/matchers/shared.rb
194
- - lib/chefspec/matchers/user.rb
195
- - lib/chefspec/minitest.rb
196
- - lib/chefspec/monkey_patches/conditional.rb
197
- - lib/chefspec/monkey_patches/hash.rb
198
- - lib/chefspec/monkey_patches/lwrp_base.rb
199
- - lib/chefspec/monkey_patches/provider.rb
118
+ - lib/chefspec/api/apt_package.rb
119
+ - lib/chefspec/api/batch.rb
120
+ - lib/chefspec/api/chef_gem.rb
121
+ - lib/chefspec/api/cookbook_file.rb
122
+ - lib/chefspec/api/cron.rb
123
+ - lib/chefspec/api/deploy.rb
124
+ - lib/chefspec/api/directory.rb
125
+ - lib/chefspec/api/dpkg_package.rb
126
+ - lib/chefspec/api/easy_install_package.rb
127
+ - lib/chefspec/api/env.rb
128
+ - lib/chefspec/api/erl_call.rb
129
+ - lib/chefspec/api/execute.rb
130
+ - lib/chefspec/api/file.rb
131
+ - lib/chefspec/api/freebsd_package.rb
132
+ - lib/chefspec/api/gem_package.rb
133
+ - lib/chefspec/api/git.rb
134
+ - lib/chefspec/api/group.rb
135
+ - lib/chefspec/api/http_request.rb
136
+ - lib/chefspec/api/ifconfig.rb
137
+ - lib/chefspec/api/include_recipe.rb
138
+ - lib/chefspec/api/ips_package.rb
139
+ - lib/chefspec/api/link.rb
140
+ - lib/chefspec/api/log.rb
141
+ - lib/chefspec/api/macports_package.rb
142
+ - lib/chefspec/api/mdadm.rb
143
+ - lib/chefspec/api/mount.rb
144
+ - lib/chefspec/api/notifications.rb
145
+ - lib/chefspec/api/ohai.rb
146
+ - lib/chefspec/api/package.rb
147
+ - lib/chefspec/api/pacman_package.rb
148
+ - lib/chefspec/api/portage_package.rb
149
+ - lib/chefspec/api/powershell_script.rb
150
+ - lib/chefspec/api/registry_key.rb
151
+ - lib/chefspec/api/remote_directory.rb
152
+ - lib/chefspec/api/remote_file.rb
153
+ - lib/chefspec/api/render_file.rb
154
+ - lib/chefspec/api/route.rb
155
+ - lib/chefspec/api/rpm_package.rb
156
+ - lib/chefspec/api/ruby_block.rb
157
+ - lib/chefspec/api/script.rb
158
+ - lib/chefspec/api/service.rb
159
+ - lib/chefspec/api/smartos_package.rb
160
+ - lib/chefspec/api/solaris_package.rb
161
+ - lib/chefspec/api/subversion.rb
162
+ - lib/chefspec/api/template.rb
163
+ - lib/chefspec/api/user.rb
164
+ - lib/chefspec/api/yum_package.rb
165
+ - lib/chefspec/api.rb
166
+ - lib/chefspec/berkshelf.rb
167
+ - lib/chefspec/deprecations.rb
168
+ - lib/chefspec/errors.rb
169
+ - lib/chefspec/expect_exception.rb
170
+ - lib/chefspec/extensions/chef/client.rb
171
+ - lib/chefspec/extensions/chef/conditional.rb
172
+ - lib/chefspec/extensions/chef/data_query.rb
173
+ - lib/chefspec/extensions/chef/lwrp_base.rb
174
+ - lib/chefspec/extensions/chef/resource.rb
175
+ - lib/chefspec/extensions/chef/securable.rb
176
+ - lib/chefspec/formatter.rb
177
+ - lib/chefspec/macros.rb
178
+ - lib/chefspec/matchers/include_recipe_matcher.rb
179
+ - lib/chefspec/matchers/link_to_matcher.rb
180
+ - lib/chefspec/matchers/notifications_matcher.rb
181
+ - lib/chefspec/matchers/render_file_matcher.rb
182
+ - lib/chefspec/matchers/resource_matcher.rb
183
+ - lib/chefspec/matchers.rb
184
+ - lib/chefspec/renderer.rb
185
+ - lib/chefspec/rspec.rb
186
+ - lib/chefspec/runner.rb
187
+ - lib/chefspec/stubs/command_registry.rb
188
+ - lib/chefspec/stubs/command_stub.rb
189
+ - lib/chefspec/stubs/data_bag_item_registry.rb
190
+ - lib/chefspec/stubs/data_bag_item_stub.rb
191
+ - lib/chefspec/stubs/data_bag_registry.rb
192
+ - lib/chefspec/stubs/data_bag_stub.rb
193
+ - lib/chefspec/stubs/registry.rb
194
+ - lib/chefspec/stubs/search_registry.rb
195
+ - lib/chefspec/stubs/search_stub.rb
196
+ - lib/chefspec/stubs/stub.rb
200
197
  - lib/chefspec/version.rb
201
198
  - lib/chefspec.rb
202
199
  homepage: http://acrmp.github.com/chefspec
@@ -214,14 +211,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
214
211
  version: '1.9'
215
212
  required_rubygems_version: !ruby/object:Gem::Requirement
216
213
  requirements:
217
- - - '>='
214
+ - - '>'
218
215
  - !ruby/object:Gem::Version
219
- version: '0'
216
+ version: 1.3.1
220
217
  requirements: []
221
218
  rubyforge_project:
222
219
  rubygems_version: 2.0.3
223
220
  signing_key:
224
221
  specification_version: 4
225
- summary: chefspec-2.0.1
222
+ summary: chefspec-3.0.0.beta.1
226
223
  test_files: []
227
224
  has_rdoc:
@@ -1,34 +0,0 @@
1
- class Chef
2
- module ExpectException
3
- class << self
4
- def expected?(chef_message, exception, *args)
5
- @b.call(chef_message, exception)
6
- end
7
-
8
- def expect(klass, message)
9
- expect_block do |chef_message, exception|
10
- match?(exception, klass, message)
11
- end
12
- end
13
-
14
- def expect_block(&block)
15
- @b = block
16
- end
17
-
18
- def clear
19
- @b = lambda{|cm, e| false}
20
- clear_seen
21
- end
22
-
23
- def clear_seen
24
- @seen = []
25
- end
26
-
27
- def match?(exception, klass, message)
28
- exception.class == klass and exception.message == message
29
- end
30
- end
31
-
32
- clear
33
- end
34
- end
@@ -1,233 +0,0 @@
1
- if defined?(Chef::Formatters::Base)
2
- class Chef
3
- module Formatters
4
- class ChefSpec < Base
5
- cli_name(:chefspec)
6
-
7
- attr_reader :updated_resources, :updates_by_resource
8
-
9
- def initialize(out, err)
10
- super
11
- @updated_resources = []
12
- @updates_by_resource = Hash.new {|h, k| h[k] = []}
13
- end
14
-
15
- def error_expected?(message, exception, *args)
16
- ExpectException.expected?(message, exception, *args)
17
- end
18
-
19
- # Called at the very start of a Chef Run
20
- def run_start(version)
21
- puts "Starting Chef Client, version #{version}"
22
- end
23
-
24
- # Called at the end of the Chef run.
25
- def run_completed(node)
26
- end
27
-
28
- # called at the end of a failed run
29
- def run_failed(exception)
30
- return if error_expected?(:run_failed, exception)
31
- puts "chef client failed. #{@updated_resources.size} resources updated"
32
- end
33
-
34
- # Called right after ohai runs.
35
- def ohai_completed(node)
36
- end
37
-
38
- # Already have a client key, assuming this node has registered.
39
- def skipping_registration(node_name, config)
40
- end
41
-
42
- # About to attempt to register as +node_name+
43
- def registration_start(node_name, config)
44
- end
45
-
46
- def registration_completed
47
- end
48
-
49
- # Failed to register this client with the server.
50
- def registration_failed(node_name, exception, config)
51
- super unless error_expected?(:registration_failed, exception, config, node_name)
52
- end
53
-
54
- def node_load_start(node_name, config)
55
- end
56
-
57
- # Failed to load node data from the server
58
- def node_load_failed(node_name, exception, config)
59
- super unless error_expected?(:node_load_failed, exception)
60
- end
61
-
62
- def run_list_expand_failed(expanded_run_list, exception)
63
- super unless error_expected?(:run_list_expand_failed, exception, expanded_run_list)
64
- end
65
-
66
- # Default and override attrs from roles have been computed, but not yet applied.
67
- # Normal attrs from JSON have been added to the node.
68
- def node_load_completed(node, expanded_run_list, config)
69
- end
70
-
71
- # Called before the cookbook collection is fetched from the server.
72
- def cookbook_resolution_start(expanded_run_list)
73
- end
74
-
75
- # Called when there is an error getting the cookbook collection from the
76
- # server.
77
- def cookbook_resolution_failed(expanded_run_list, exception)
78
- super unless error_expected?(:cookbook_resolution_failed, exception, expanded_run_list)
79
- end
80
-
81
- def cookbook_sync_failed(cookbooks, exception)
82
- super unless error_expected?(:cookbook_sync_failed, exception, cookbooks)
83
- end
84
-
85
- # Called when the cookbook collection is returned from the server.
86
- def cookbook_resolution_complete(cookbook_collection)
87
- end
88
-
89
- # Called before unneeded cookbooks are removed
90
- #--
91
- # TODO: Should be called in CookbookVersion.sync_cookbooks
92
- def cookbook_clean_start
93
- end
94
-
95
- # Called after the file at +path+ is removed. It may be removed if the
96
- # cookbook containing it was removed from the run list, or if the file was
97
- # removed from the cookbook.
98
- def removed_cookbook_file(path)
99
- end
100
-
101
- # Called when cookbook cleaning is finished.
102
- def cookbook_clean_complete
103
- end
104
-
105
- # Called before cookbook sync starts
106
- def cookbook_sync_start(cookbook_count)
107
- end
108
-
109
- # Called when cookbook +cookbook_name+ has been sync'd
110
- def synchronized_cookbook(cookbook_name)
111
- end
112
-
113
- # Called when an individual file in a cookbook has been updated
114
- def updated_cookbook_file(cookbook_name, path)
115
- end
116
-
117
- # Called after all cookbooks have been sync'd.
118
- def cookbook_sync_complete
119
- end
120
-
121
- # Called when cookbook loading starts.
122
- def library_load_start(file_count)
123
- end
124
-
125
- # Called after a file in a cookbook is loaded.
126
- def file_loaded(path)
127
- end
128
-
129
- def file_load_failed(path, exception, message = :file_load_failed, &block)
130
- super(path, exception, &block) unless error_expected?(message, exception, path)
131
- end
132
-
133
- def library_file_load_failed(path, exception)
134
- file_load_failed(path, exception, :library_file_load_failed)
135
- end
136
-
137
- def lwrp_file_load_failed(path, exception)
138
- file_load_failed(path, exception, :lwrp_file_load_failed)
139
- end
140
-
141
- def attribute_file_load_failed(path, exception)
142
- file_load_failed(path, exception, :attribute_file_load_failed)
143
- end
144
-
145
- def definition_file_load_failed(path, exception)
146
- file_load_failed(path, exception, :definition_file_load_failed)
147
- end
148
-
149
- def recipe_file_load_failed(path, exception)
150
- file_load_failed(path, exception, :recipe_file_load_failed)
151
- end
152
-
153
- # Called when recipes have been loaded.
154
- def recipe_load_complete
155
- end
156
-
157
- # Called before convergence starts
158
- def converge_start(run_context)
159
- end
160
-
161
- # Called when the converge phase is finished.
162
- def converge_complete
163
- end
164
-
165
- # Called before action is executed on a resource.
166
- def resource_action_start(resource, action, notification_type=nil, notifier=nil)
167
- end
168
-
169
- # Called when a resource fails, but will retry.
170
- def resource_failed_retriable(resource, action, retry_count, exception)
171
- super unless error_expected?(:resource_failed_retriable, exception, retry_count, action, resource)
172
- end
173
-
174
- # Called when a resource fails and will not be retried.
175
- def resource_failed(resource, action, exception)
176
- super unless error_expected?(:resource, exception, exception, resource)
177
- end
178
-
179
- # Called when a resource action has been skipped b/c of a conditional
180
- def resource_skipped(resource, action, conditional)
181
- end
182
-
183
- # Called after #load_current_resource has run.
184
- def resource_current_state_loaded(resource, action, current_resource)
185
- end
186
-
187
- # Called when a resource has no converge actions, e.g., it was already correct.
188
- def resource_up_to_date(resource, action)
189
- end
190
-
191
- ## TODO: callback for assertion failures
192
-
193
- ## TODO: callback for assertion fallback in why run
194
-
195
- def recipe_not_found(exception)
196
- super unless error_expected?(:recipe_not_found, exception)
197
- end
198
-
199
- # Called when a change has been made to a resource. May be called multiple
200
- # times per resource, e.g., a file may have its content updated, and then
201
- # its permissions updated.
202
- def resource_update_applied(resource, action, update)
203
- @updates_by_resource[resource.name] << Array(update)[0]
204
- end
205
-
206
- # Called after a resource has been completely converged.
207
- def resource_updated(resource, action)
208
- updated_resources << resource
209
- end
210
-
211
- # Called before handlers run
212
- def handlers_start(handler_count)
213
- end
214
-
215
- # Called after an individual handler has run
216
- def handler_executed(handler)
217
- end
218
-
219
- # Called after all handlers have executed
220
- def handlers_completed
221
- end
222
-
223
- # An uncategorized message. This supports the case that a user needs to
224
- # pass output that doesn't fit into one of the callbacks above. Note that
225
- # there's no semantic information about the content or importance of the
226
- # message. That means that if you're using this too often, you should add a
227
- # callback for it.
228
- def msg(message)
229
- end
230
- end
231
- end
232
- end
233
- end