Chef

Templates used in definitions searched for only the cookbook they are used in

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 0.5.1, 0.5.2
  • Fix Version/s: 0.5.4
  • Component/s: Recipes, Resources
  • Labels:
    None

Description

If you use a template inside of a definition, the system only searches for the source file inside of the cookbook where the template is being used, and not the cookbook where the template is defined

Activity

Hide
Kris Rasmussen added a comment - 31/Jan/09 1:38 AM

I'm hitting this one too

Show
Kris Rasmussen added a comment - 31/Jan/09 1:38 AM I'm hitting this one too
Hide
Adam Jacob added a comment - 03/Feb/09 2:03 AM

We'll get this fixed in the upcoming release.

Show
Adam Jacob added a comment - 03/Feb/09 2:03 AM We'll get this fixed in the upcoming release.
Hide
Adam Jacob added a comment - 12/Feb/09 6:32 AM

This is fixed in the opscode/master.

With template and remote_file resources, you can now specify a 'cookbook' attribute, which controls what cookbook we look for the source file in. This means that if you have two cookbooks, foo and bar, you could do:

  1. In foo
    template "/tmp/test.txt" do
    source "test.txt.erb"
    cookbook "bar"
    end
  1. In bar
    template "/tmp/test.txt" do
    source "test.txt.erb"
    end

And both would use cookbooks/bar/templates/default/test.txt.erb.

Note that you really should only do this if you are shipping a definition that has a default template. My suggestion would be to make it overridable as an attribute of the definition as well.

Show
Adam Jacob added a comment - 12/Feb/09 6:32 AM This is fixed in the opscode/master. With template and remote_file resources, you can now specify a 'cookbook' attribute, which controls what cookbook we look for the source file in. This means that if you have two cookbooks, foo and bar, you could do:
  1. In foo template "/tmp/test.txt" do source "test.txt.erb" cookbook "bar" end
  1. In bar template "/tmp/test.txt" do source "test.txt.erb" end
And both would use cookbooks/bar/templates/default/test.txt.erb. Note that you really should only do this if you are shipping a definition that has a default template. My suggestion would be to make it overridable as an attribute of the definition as well.

People

Vote (1)
Watch (1)

Dates

  • Created:
    30/Jan/09 11:49 PM
    Updated:
    12/Feb/09 6:32 AM
    Resolved:
    12/Feb/09 6:32 AM