Module: Chef::Sugar::RecipeDSL

Defined in:
lib/chef/sugar/filters.rb

Instance Method Summary collapse

Instance Method Details

#compile_time(&block) ⇒ Object

Deprecated.

The description is in the method body pretty accurately…



157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/chef/sugar/filters.rb', line 157

def compile_time(&block)
  message = "\nThe Chef Sugar recipe DSL method `compile_time' has been renamed to\n`at_compile_time'! This is a breaking change that was released in a patch\nversion, so please continue reading to understand the necessary semantic\nversioning violation.\n\nChef Software implemented a version of `compile_time' in Chef 12.1, breaking any \ncookbook that uses or depends on Chef Sugar on Chef 12.1:\n\n    https://www.chef.io/blog/2015/03/03/chef-12-1-0-released\n\nIn order to progress Chef Sugar forward, the DSL method has been renamed to\navoid the namespace collision.\n\nIn short, you should change this:\n\n    compile_time do\n# ...\n    end\n\nto this:\n\n    at_compile_time do\n# ...\n    end\n\n"

  if Chef::Resource::ChefGem.instance_methods(false).include?(:compile_time)
    message << "You are running a version of Chef Client that includes the `compile_time'\nattribute on core Chef resources (most likely Chef 12.1+). Instead of continuing\nand having Chef provide you with an obscure error message, I am going to error\nhere. There is no way for the Chef Recipe to successfully continue unless you\nchange the Chef Sugar `compile_time' method to `at_compile_time' in your Chef\nrecipes.\n\nYou should NOT change resource-level `compile_time' attributes:\n\n    package \"foo\" do\ncompile_time true # Do NOT change these\n    end\n\nI truly apologize for the inconvienence and hope the reason for introducing this\nbreaking change is clear. I am sorry if it causes extra work, but I promise this\nerror message is much more informative than \"wrong number of arguments\".\n\nIf you have any questions, please feel free to open an issue on GitHub at:\n\n    https://github.com/sethvargo/chef-sugar\n\nThank you, and have a great day!\n"
    raise RuntimeError, message
  else
    message << "You are running a version of Chef Client that does not include the\n`compile_time' attribute on core Chef resources (most likely less than\nChef 12.1), so this is just a warning. Please consider changing the Chef Sugar\n`compile_time' method to `at_compile_time' in your Chef recipes. If you upgrade\nChef, your recipes WILL break.\n"
    Chef::Log.warn(message)
    at_compile_time(&block)
  end
end