[chef] Re: Re: using a template in a provider fails, because it looks for the template in the wrapper ! whats the solution ?


Chronological Thread 
  • From: Medya < >
  • To:
  • Subject: [chef] Re: Re: using a template in a provider fails, because it looks for the template in the wrapper ! whats the solution ?
  • Date: Fri, 13 Feb 2015 12:13:43 -0600

how do I add a name to a template resource?

On Fri, Feb 13, 2015 at 12:03 PM, Kimball Johnson < " target="_blank"> > wrote:
You can add the name of the cookbook to the template resource:

cookbook "cccis-weblogic"



> On 13 Feb 2015, at 17:48, Medya < "> > wrote:
>
> I have made a resource that has a "template" resource that creates a file.
>
> this is in my provider's action :create
>   #Create silent.xml file out of the template
>   template "#{Chef::Config[:file_cache_path]}/silent.xml" do
>     source 'silent.xml.erb'
>     owner new_resource.user
>     group new_resource.group
>     mode '0755'
>   end
>
>
>
> I use this resource in another cookbook and it fails because it is trying find the template's .ERB file in the wrapper cookbook which is using the resource...
>
>
> what is the proper solution for this problem? should I use File resource instead of template?
>
> the error I get is :
>
>                                                   [2015-02-13T12:39:43-05:00] ERROR: cccis-weblogic[/tools/binaries/Middleware/wlserver_1036] (medya-demo-machines::test_weblogic_lwrp line 3) had an error: Chef::Exceptions::FileNotFound: template[/var/chef/cache/silent.xml] (/var/chef/cache/cookbooks/cccis-weblogic/providers/default.rb line 48) had an error: Chef::Exceptions::FileNotFound: Cookbook 'medya-demo-machines' (0.0.1) does not contain a file at any of these locations:
>
>                                                     templates/redhat-7.0/silent.xml.erb
>
>                                                     templates/redhat/silent.xml.erb
>
>                                                     templates/default/silent.xml.erb
>
>                                                     templates/silent.xml.erb
>




Archive powered by MHonArc 2.6.16.

§