Holger Brueckner
2007-Mar-29 17:40 UTC
some questions regarding inhert, unless/onlyif and notify on recursive objects
hello, i''m just playing around with the really great puppet to learn the syntax and see what it can do. i''m using puppet 0.22.1 on debian etch. i created a aide class to distribute a modified aide.conf.d directory and if not already done initialize the database (yes this should probably be better organized and databas initialization should be performed as the last step): class aide { package { "aide": ensure => installed, } exec { "update-aide.conf": cwd => "/tmp", path => "/bin:/usr/bin:/sbin:/usr/sbin", command => "/usr/sbin/update-aide.conf", } exec { "aide.wrapper --init": cwd => "/tmp", path => "/bin:/usr/bin:/sbin:/usr/sbin", command => "if test ! -f /var/lib/aide/aide.db.new ; then /usr/bin/aide.wrapper --init; fi", creates => "/var/lib/aide/aide.db.new", onlyif => "test ! -f /var/lib/aide/aide.db.new", subscribe => Exec["update-aide.conf"], notify => Exec["cp /var/lib/aide/aide.db.new /var/lib/aide/aide.db"], } exec { "cp /var/lib/aide/aide.db.new /var/lib/aide/aide.db": cwd => "/tmp", path => "/bin:/usr/bin:/sbin:/usr/sbin", command => "if test ! -f /var/lib/aide/aide.db ; then /bin/cp /var/lib/aide/aide.db.new /var/lib/aide/aide.db; fi", onlyif => "test ! -f /var/lib/aide/aide.db", } file { "/etc/aide/aide.conf.d": source => "puppet://$puppetmaster/files/global/aide/aide.conf.d", recurse => "true", backup => false, ignore => ".svn", notify => Exec["update-aide.conf"], } } first problem: "update-aide.conf" always gets called. even if no file has changed in "/etc/aide/aide.conf.d" puppetd detects a change and notifies update-aide.conf exec: debug: //base_node/aide/Exec[update-aide.conf]: Changing returns debug: //base_node/aide/Exec[update-aide.conf]: 1 change(s) debug: //base_node/aide/Exec[update-aide.conf]: Executing ''/usr/sbin/update-aide.conf'' is it possible to enhance the debug level to actually see what that change is supposed to be ? there''s no notice line about a change in the debug log. second problem: onlyif/unless don''t work on notify/subscribe. just realized this is fixed in 0.22.2+ third problem: i''m using something like: node ''base_node'':{ } node ''node1.my.domain'' inherits base_node { } which works fine. it does not work if i also quote base_node: node ''node1.my.domain'' inherits ''base_node'' { } Syntax error at ''base_node'' at /etc/puppet/manifests/nodes/node1.my.domain.pp is this a bug in the parser or intended ? besides these small problems great work :-). holger
Luke Kanies
2007-Mar-29 19:49 UTC
Re: some questions regarding inhert, unless/onlyif and notify on recursive objects
On Mar 29, 2007, at 12:40 PM, Holger Brueckner wrote:> first problem: > > "update-aide.conf" always gets called. even if no file has changed in > "/etc/aide/aide.conf.d" puppetd detects a change and notifies > update-aide.conf exec:You should add ''refreshonly => true'' to the specification of this script.> debug: //base_node/aide/Exec[update-aide.conf]: Changing returns > debug: //base_node/aide/Exec[update-aide.conf]: 1 change(s) > debug: //base_node/aide/Exec[update-aide.conf]: Executing > ''/usr/sbin/update-aide.conf'' > > is it possible to enhance the debug level to actually see what that > change is supposed to be ? there''s no notice line about a change in > the > debug log.The logging for ''exec'' isn''t as good because it''s not really a resource. The work is done by the ''returns'' property, which isn''t really a property of course, which is the logging is weird. The problem is that you need to enable refreshonly.> > node ''node1.my.domain'' inherits ''base_node'' { > > } > Syntax error at ''base_node'' > at /etc/puppet/manifests/nodes/node1.my.domain.pp > > is this a bug in the parser or intended ?It''s a bug in the parser. I''d appreciate it if you''d file it as such. -- The conception of two people living together for twenty-five years without having a cross word suggests a lack of spirit only to be admired in sheep. --Alan Patrick Herbert --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
Holger Brueckner
2007-Mar-30 08:54 UTC
Re: some questions regarding inhert, unless/onlyif and notify on recursive objects
On Thu, 2007-03-29 at 14:49 -0500, Luke Kanies wrote:> The problem is that you need to enable refreshonly.indeed, thanks a lot> > node ''node1.my.domain'' inherits ''base_node'' { > > > > } > > Syntax error at ''base_node'' > > at /etc/puppet/manifests/nodes/node1.my.domain.pp > > > > is this a bug in the parser or intended ? > > It''s a bug in the parser. I''d appreciate it if you''d file it as such.done, see Ticket #568 h.