Skip to content

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

Open
@samsworldofno

Description

@samsworldofno

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions