- From: Hedge Hog <
>
- To:
- Subject: [chef] Allow 'recipe[cookbook]' to accept exact (current) and general regexp matches
- Date: Thu, 9 Dec 2010 08:56:13 +1100
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=TYyw6YUWkl4sn71iRAVGOxjn9whGXjG2VSNFe5LFB1t79pbMId7UanUTJd2q5Yxkap i+d7+yQv6XnYONJYy7pFebrPRfFxuP5hxNJOOxvMvNOeWHMue8/xn8SicX+IFm8bKvZZ TQ6JL3+auw5E8kE5ECtZuslRfZ71NTTVq9dmE=
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
- [chef] Allow 'recipe[cookbook]' to accept exact (current) and general regexp matches, Hedge Hog, 12/08/2010
Archive powered by MHonArc 2.6.16.