Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cookbook 'nginx' does not contain a file (templates/default/nginx-site.erb) (+fix) #11

Open
samsworldofno opened this issue Jul 17, 2014 · 3 comments

Comments

@samsworldofno
Copy link

Hi,

When using this cookbook with nginx as the web server, I encountered the following error:


==> magento: ================================================================================
==> magento: Error executing action `create` on resource 'template[/etc/nginx/sites-available/default]'
==> magento: ================================================================================
==> magento: 
==> magento: 
==> magento: Chef::Exceptions::FileNotFound
==> magento: ------------------------------
==> magento: Cookbook 'nginx' (2.7.4) does not contain a file at any of these locations:
==> magento:   templates/centos-6.5/nginx-site.erb
==> magento:   templates/centos/nginx-site.erb
==> magento:   templates/default/nginx-site.erb

This is because the template defined on line 26 of the _web_nginx recipe is duplicating the template already defined within the nginx recipe at "#{node['nginx']['dir']}/sites-available/default" which installs the nginx default site, later to be deleted by this recipe.

When a template is defined twice, the second definition inherits attributes from the first, including it seems the cookbook - meaning that when the magento recipe attempts to write this file from its own template, chef looks in the nginx cookbook for the file.

A simple fix is adding cookbook "magento" to the template definition in _web_nginx. This forces chef to look for the resource in the magento recipe.

I wasn't sure whether it would be something you'd want to include, or look at a different solution such as not installing the nginx default site in the first place... but thought I'd document since I'd figured it out. I can submit a PR with the change if you like.

@brint
Copy link
Collaborator

brint commented Aug 4, 2014

Hi @samsworldofno, thanks for opening the issue. I'm having problems re-creating the issue with a kitchen test. I'm running chef-client 11.14.2 with master of this repo with nginx cookbook version 2.7.4 (current release). Are you running different versions of any of these things?

@samsworldofno
Copy link
Author

Hi Brint,

I'm using 2.7.4 of the nagios cookbook, and I'm building chef solo (11.12.8) via vagrant. I haven't tried with a more recent version of the chef gem but I can do. I believed the behaviour is intended so hadn't checked with other versions.

Thanks,

Sam

@brint
Copy link
Collaborator

brint commented Aug 5, 2014

@samsworldofno Let me know if the newest version is giving you the same error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants