- From: Kim Nielsen <
>
- To:
- Subject: [chef] Providers
- Date: Fri, 14 Aug 2015 14:58:57 +0200
Hi,
I have been playing with a logrotate cookbook where I want to generated
logrotate.conf delayed due to other cookbooks input. But for some reason I
can't seem to trigger a provider
resources/logrotate.rb
actions :create
default_action :create
def initialize(*args)
super
@action = :create_logrotate_conf
end
providers/logrotate.rb
def whyrun_supported?
true
end
use_inline_resources
def generate_logrotate_conf
t = template "/etc/logrotate.conf" do
source "logrotate.conf.erb"
mode "0644"
end
end
action :create do
Chef::Log.warn "------ never run -----------"
generate_logrotate_conf
end
and in my recipe I have I'm running a definition like so
logrotate "#{curfile}" do
enabled node['logrotate']["#{curfile}"]['enabled']
logs node['logrotate']["#{curfile}"]['logs']
options node['logrotate']["#{curfile}"]['options']
ifpostrotate node['logrotate']["#{curfile}"]['ifpostrotate']
postrotate node['logrotate']["#{curfile}"]['postrotate']
ifprerotate node['logrotate']["#{curfile}"]['ifprerotate']
prerotate node['logrotate']["#{curfile}"]['prerotate']
action :create
end
Can anyone point me to what I'm doing wrong or if there is a better way to
create the logrotate.conf file when all other cookbooks are done using?
--
Med venlig hilsen/Kind regards
Kim Nielsen
Attachment:
signature.asc
Description: Message signed with OpenPGP using GPGMail
- [chef] Providers, Kim Nielsen, 08/14/2015
Archive powered by MHonArc 2.6.16.