[chef] Re: Re: overwriting a template


Chronological Thread 
  • From: Geoffrey Owen < >
  • To:
  • Subject: [chef] Re: Re: overwriting a template
  • Date: Mon, 23 Jun 2014 10:41:58 -0500

I did a little digging over the weekend, and it looks like it is loading my default recipe first, so the template has not been defined for redisio yet.  I have the order set so it should be running the recipe first, but the redisio install.rb doesn't have the "template" in it.  Rather it is contained in the "providers/install.rb".  Is there anyway to override this in the provider?

Thanks,

Geoff


On Fri, Jun 20, 2014 at 2:08 PM, Geoffrey Owen < " target="_blank"> > wrote:
 Darn, no luck.  Either way it says:
================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/role_redisserver/recipes/default.rb
================================================================================


Chef::Exceptions::ResourceNotFound
----------------------------------
Cannot find a resource matching template[/etc/init.d/redis6379] (did you define it first?)

Is it because the file is referenced in a provider?  So it hasn't been defined yet?


On Fri, Jun 20, 2014 at 1:40 PM, Ranjib Dey < " target="_blank"> > wrote:
huh!
formatting borked
----

rewind "template[/etc/init.d/redis\#{server_name}]" do

  source "redis.init.erb"
  cookbook_name "role_redisserver"
end


On Fri, Jun 20, 2014 at 11:38 AM, Ranjib Dey < " target="_blank"> > wrote:
try

rewind "template [/etc/init.d/redis6379]" do
  source "redis.init.erb"
  cookbook_name "role_redisserver"
end


On Fri, Jun 20, 2014 at 11:04 AM, < " target="_blank"> > wrote:
Hi,

I am working with the redisio cookbook, and I would like to overwrite the init
script template with my own.  I see this:

redisio/providers/install.rb:

      template "/etc/init.d/redis#{server_name}" do
        source 'redis.init.erb'
        cookbook 'redisio'
        owner 'root'
        group 'root'
        mode '0755'
        variables({
          :name => server_name,
          :bin_path => bin_path,
          :job_control => current['job_control'],
          :port => current['port'],
          :address => current['address'],
          :user => current['user'],
          :configdir => current['configdir'],
          :piddir => piddir,
          :requirepass => current['requirepass'],
          :shutdown_save => current['shutdown_save'],
          :platform => node['platform'],
          :unixsocket => current['unixsocket'],
          :ulimit => descriptors
          })
        only_if { current['job_control'] == 'initd' }
      end

when I use:

rewind :template => "/etc/init.d/redis\#{server_name}" do
  source "redis.init.erb"
  cookbook_name "role_redisserver"
end

or

rewind :template => "/etc/init.d/redis6379" do
  source "redis.init.erb"
  cookbook_name "role_redisserver"
end

I keep getting the error:

Chef::Exceptions::ResourceNotFound
----------------------------------
Cannot find a resource matching template[/etc/init.d/redis#{server_name}] (did
you define it first?)

Is there a way to overwrite this template with it not being referenced in a
recipe?

Thanks in advance,

Geoff







Archive powered by MHonArc 2.6.16.

§