Since it’s ruby, I assume it’s possible to have a resource run within
another scope as defined at runtime. I basically ran into a situation where
I defined a variable that I used to inject information in a template in a
library cookbook, then found that I also wanted access to that variable
from the wrapper cookbook.
I could probably put it in a library, but at this point I’m just curious if
anyone has done this. Can you run a resource in another cookbook’s recipe
if you even wanted to?
Not saying this is the correct way to do it, just curious if it’s actually
possible.
I've run defines and used LWRPs in other recipes -- seems to work, as long
as the defining cookbook is loaded up earlier in the run list. However, I
don't like the idea of leaving it up to the user to figure out whether or
not they need to add some_random_cookbook to a run list, so I've adopted
the pattern of "include_recipe 'some_random_cookbook::default'" and simply
not putting anything of substance in a default recipe that isn't required
across the entire cookbook.
Since it's ruby, I assume it's possible to have a resource run within
another scope as defined at runtime. I basically ran into a situation where
I defined a variable that I used to inject information in a template in a
library cookbook, then found that I also wanted access to that variable
from the wrapper cookbook.
I could probably put it in a library, but at this point I'm just curious
if anyone has done this. Can you run a resource in another cookbook's
recipe if you even wanted to?
Not saying this is the correct way to do it, just curious if it's actually
possible.
A member of Heavy Water Operations (Chris Roberts, spox) just build a
system that allows arbitrary injection of resources at any time in the
recipe life cycle. Chris had noticed a pattern used like this in the
AWS OpsWorks tool and set out to re-implement.
Check it out. I'll endeavor to pass any feedback his way. [0]
I've run defines and used LWRPs in other recipes -- seems to work, as long
as the defining cookbook is loaded up earlier in the run list. However, I
don't like the idea of leaving it up to the user to figure out whether or
not they need to add some_random_cookbook to a run list, so I've adopted the
pattern of "include_recipe 'some_random_cookbook::default'" and simply not
putting anything of substance in a default recipe that isn't required across
the entire cookbook.
Since it's ruby, I assume it's possible to have a resource run within
another scope as defined at runtime. I basically ran into a situation where
I defined a variable that I used to inject information in a template in a
library cookbook, then found that I also wanted access to that variable from
the wrapper cookbook.
I could probably put it in a library, but at this point I'm just curious
if anyone has done this. Can you run a resource in another cookbook's recipe
if you even wanted to?
Not saying this is the correct way to do it, just curious if it's actually
possible.
Ah the injector is pretty cool. I'm not sure if / when I'll encounter this
use case again, but it's a nice tool to have in the toolbox.
Thanks,
-Kevin
On Mon, Apr 15, 2013 at 2:41 PM, AJ Christensen aj@junglist.gen.nz wrote:
A member of Heavy Water Operations (Chris Roberts, spox) just build a
system that allows arbitrary injection of resources at any time in the
recipe life cycle. Chris had noticed a pattern used like this in the
AWS OpsWorks tool and set out to re-implement.
Check it out. I'll endeavor to pass any feedback his way. [0]
I've run defines and used LWRPs in other recipes -- seems to work, as
long
as the defining cookbook is loaded up earlier in the run list. However,
I
don't like the idea of leaving it up to the user to figure out whether or
not they need to add some_random_cookbook to a run list, so I've adopted
the
pattern of "include_recipe 'some_random_cookbook::default'" and simply
not
putting anything of substance in a default recipe that isn't required
across
the entire cookbook.
Since it's ruby, I assume it's possible to have a resource run within
another scope as defined at runtime. I basically ran into a situation
where
I defined a variable that I used to inject information in a template in
a
library cookbook, then found that I also wanted access to that variable
from
the wrapper cookbook.
I could probably put it in a library, but at this point I'm just curious
if anyone has done this. Can you run a resource in another cookbook's
recipe
if you even wanted to?
Not saying this is the correct way to do it, just curious if it's
actually
possible.