Allow 'recipe' to accept exact (current) and general regexp matches


#1

Hi,
At the moment Chef seems (afaict, but I haven’t yet digested all the
spec’s and code) to accept only an exact match in the following:

“recipe[apache2]” in ~/chef-repo/roles/*
This then is used to load the ~/chef-repo/cookbook/apache2

Any chance of accepting RegExp, ala string?
So this

“recipe[/(.)(apache2)(.)/,2]”

loads the cookbook
./chef-repo/cookbooks/rand_prefix-apt-rand_postfix

Since folder names are being used to infer cookbook names, then in
case of a multiple match, the most recently changed folder is
selected.
The value returned by the regexp, apache2 in this case is the
’internal-name’ name used
So this would not need to be changed inside the cookbook:

include_recipe “apache2::mod_status”

Thoughts and comments on opening a feature request for this.

I acknowledge the downside that using the String regexp syntax makes
recipe look like it is a string rather than a hash/array - a small
price for the additional flexibility to brings?

Best wishes.


πόλλ’ οἶδ ἀλώπηξ, ἀλλ’ ἐχῖνος ἓν μέγα
[The fox knows many things, but the hedgehog knows one big thing.]
Archilochus, Greek poet (c. 680 BC – c. 645 BC)
http://wiki.hedgehogshiatus.com