[chef] Re: overwriting a template


Chronological Thread 
  • From: Ranjib Dey < >
  • To: " " < >
  • Subject: [chef] Re: overwriting a template
  • Date: Fri, 20 Jun 2014 11:38:44 -0700

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.

§