Load only definitions into my cookbook recipe


#1

I’m trying to use the nginx cookbook, which comes with a definition to
"enable" sites.
I have a separate recipe for my application, which creates the nginx config
for the app, and puts it in sites-available. I then try to use nginx_site
definition.

The problem is, to do this, I have to “include_recipe ‘nginx’”

This is problematic for me since I’ve configured it to install from source,
and thus it recompiles nginx each time i try to deploy my app.

Is it possible to load only the definitions of the nginx cookbook into my
recipe, so the nginx::default recipe doesn’t run?


#2

On Monday, May 20, 2013 at 4:29 AM, Prajwal Manjunath wrote:

I’m trying to use the nginx cookbook, which comes with a definition to “enable” sites.
I have a separate recipe for my application, which creates the nginx config for the app, and puts it in sites-available. I then try to use nginx_site definition.

The problem is, to do this, I have to “include_recipe ‘nginx’”

This is problematic for me since I’ve configured it to install from source, and thus it recompiles nginx each time i try to deploy my app.

Is it possible to load only the definitions of the nginx cookbook into my recipe, so the nginx::default recipe doesn’t run?
Definitions should be available as long as the cookbook gets loaded. Adding a dependency in the metadata of your custom cookbook should take care of this.

What happens if you just remove the include_recipe statement?


Daniel DeLeo


#3

I tried adding a “depends ‘nginx’” in metadata.rb and removing the
include_recipe. It didn’t work.
Anyway I noticed that the nginx cookbook isn’t “supposed” to recompile on
every include. It was caused by a bug where node.automaitc_attrs[“nginx”]
wasn’t getting populated. I still haven’t fixed it, but atleast now it’s
apparent the issue is with the nginx cookbook.

On Mon, May 20, 2013 at 8:46 PM, Daniel DeLeo dan@kallistec.com wrote:

On Monday, May 20, 2013 at 4:29 AM, Prajwal Manjunath wrote:

I’m trying to use the nginx cookbook, which comes with a definition to
"enable" sites.
I have a separate recipe for my application, which creates the nginx
config for the app, and puts it in sites-available. I then try to use
nginx_site definition.

The problem is, to do this, I have to “include_recipe ‘nginx’”

This is problematic for me since I’ve configured it to install from
source, and thus it recompiles nginx each time i try to deploy my app.

Is it possible to load only the definitions of the nginx cookbook into my
recipe, so the nginx::default recipe doesn’t run?

Definitions should be available as long as the cookbook gets loaded.
Adding a dependency in the metadata of your custom cookbook should take
care of this.

What happens if you just remove the include_recipe statement?


Daniel DeLeo


#4

On Monday, May 20, 2013 at 8:24 AM, Prajwal Manjunath wrote:

I tried adding a “depends ‘nginx’” in metadata.rb and removing the include_recipe. It didn’t work.
Anyway I noticed that the nginx cookbook isn’t “supposed” to recompile on every include. It was caused by a bug where node.automaitc_attrs[“nginx”] wasn’t getting populated. I still haven’t fixed it, but atleast now it’s apparent the issue is with the nginx cookbook.

Can you explain how it doesn’t work when you remove the include_recipe statement?


Daniel DeLeo


#5

I don’t recall exactly, and I’m not at work now, so I can’t copy paste the
error message.

It was something about not finding a resource.

I’ll mail the exact thing tomorrow.

On Mon, May 20, 2013 at 9:21 PM, Daniel DeLeo dan@kallistec.com wrote:

On Monday, May 20, 2013 at 8:24 AM, Prajwal Manjunath wrote:

I tried adding a “depends ‘nginx’” in metadata.rb and removing the
include_recipe. It didn’t work.
Anyway I noticed that the nginx cookbook isn’t “supposed” to recompile on
every include. It was caused by a bug where node.automaitc_attrs[“nginx”]
wasn’t getting populated. I still haven’t fixed it, but atleast now it’s
apparent the issue is with the nginx cookbook.

Can you explain how it doesn’t work when you remove the include_recipe
statement?


Daniel DeLeo