Are exec resources triggered by notify events supposed to be run once for every event received or only run once per run irregardless of the number of resources that notified it? It seems to me that it gets run twice no matter how many resources triggered it. consider the following class: class dhcp { $prefix = "/usr/local/etc/dhcpd" $dhcpd_conf = "$prefix/dhcpd.conf" $tools_dir = "$prefix/tools" $notify_recpts = "netops-notice@csub.edu svn-dhcp-watchers@csub.edu" define dhcpfile { file { $name: path => "$prefix/$name", owner => "root", group => "wheel", mode => 0644, source => "puppet://svn.csub.edu/dist/dhcp/$name", notify => Exec[reload] } } file { "$prefix": ensure => directory, owner => "root", group => "wheel", mode => 0644; "$tools_dir": ensure => file, owner => "root", group => "wheel", mode => 0755, recurse => true, ignore => ".svn", purge => true, force => true, source => "puppet://svn.csub.edu/dist/dhcp/tools"; "$dhcpd_conf": owner => "root", group => "wheel", mode => 0644, source => "puppet://svn.csub.edu/dist/dhcp/dhcpd.$hostname", notify => Exec[reload] } dhcpfile { "dhcpd.master":; "zones":; "hosts":; "printers":; "its":; "itss":; "disabled":; } exec { reload: command => "$tools_dir/reload.sh $dhcpd_conf $notify_recpts", refreshonly => true, logoutput => true } service { dhcpd: name => "isc-dhcpd", ensure => running, hasstatus => true, provider => "init", path => "/usr/local/etc/rc.d" } } The reload exec resource is supposed to perform a "safe" restart by checking for syntactical correctness before doing the restart and notify the $notify_recpts in the event that the check fails (I should probably make sure the files are correct before they ever get on the server...). Every time a resource or resource changes, this script gets executed exactly twice. This isn''t fatal, but it''s annoying to get two notices every time someone breaks dhcp ;-). Is this the expected/intended behavior? Also, if anyone else has any uber isc-dhcp classes/providers they''ve written, I''d be very interested in seeing them. Thanks, -- Russell A. Jackson <raj@csub.edu> Network Analyst California State University, Bakersfield Everyone is entitled to my opinion. _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
On Jul 16, 2007, at 4:38 PM, Russell Jackson wrote:> Are exec resources triggered by notify events supposed to be run > once for every event > received or only run once per run irregardless of the number of > resources that notified > it? It seems to me that it gets run twice no matter how many > resources triggered it. > consider the following class:It should only get run once, as long as you have refreshonly set, which you do. Is anyone else experiencing this?> > dhcpfile { > "dhcpd.master":; > "zones":; > "hosts":; > "printers":; > "its":; > "itss":; > "disabled":; > }This can be shortened to: dhcpfile { ["dhcpd.master", zones, hosts, printers, ...]: } -- One of the Ten Commandments for Technicians (7) Work thou not on energized equipment, for if thou dost, thy fellow workers will surely buy beers for thy widow and console her in other ways. --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
--On Monday, July 16, 2007 02:38:22 PM -0700 Russell Jackson <raj@csub.edu> wrote:> Are exec resources triggered by notify events supposed to be run once for > every event received or only run once per run irregardless of the number > of resources that notified it? It seems to me that it gets run twice no > matter how many resources triggered it. consider the following class:I haven''t noticed anything exactly like that. What version are you running? What does the debug output look like on the client? -- Digant C Kasundra <digant@stanford.edu> Technical Lead, ITS Unix Systems and Applications, Stanford University
Digant C Kasundra wrote:> --On Monday, July 16, 2007 02:38:22 PM -0700 Russell Jackson <raj@csub.edu> > wrote: > >> Are exec resources triggered by notify events supposed to be run once for >> every event received or only run once per run irregardless of the number >> of resources that notified it? It seems to me that it gets run twice no >> matter how many resources triggered it. consider the following class: > > I haven''t noticed anything exactly like that. What version are you > running? What does the debug output look like on the client? >Sorry. I should know better than to leave out information like that. # uname -a FreeBSD thor.csub.edu 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Fri Jul 13 19:38:42 PDT 2007 rjackson3@thor.csub.edu:/usr/obj/usr/src/sys/THOR i386 # puppet -V 0.22.4 # puppetd --confdir /usr/local/etc/puppet --onetime --verbose --debug debug: puppetd: Setting report to ''false'' debug: puppetd: Setting runinterval to ''60'' debug: puppetd: Setting listen to ''true'' debug: /puppetconfig/puppet/File[/var/puppet/lib]: Autorequiring File[/var/puppet] debug: /puppetconfig/puppet/File[/var/puppet/state]: Autorequiring File[/var/puppet] debug: /puppetconfig/puppetd/File[/var/puppet/log/http.log]: Autorequiring File[/var/puppet/log] debug: /puppetconfig/puppet/File[/var/puppet/plugins]: Autorequiring File[/var/puppet] debug: /puppetconfig/puppet/File[/usr/local/etc/puppet/namespaceauth.conf]: Autorequiring File[/usr/local/etc/puppet] debug: /puppetconfig/puppetd/File[/usr/local/etc/puppet/classes.txt]: Autorequiring File[/usr/local/etc/puppet] debug: /puppetconfig/puppet/File[/var/puppet/templates]: Autorequiring File[/var/puppet] debug: /puppetconfig/puppet/File[/usr/local/etc/puppet/ssl]: Autorequiring File[/usr/local/etc/puppet] debug: /puppetconfig/puppet/File[/var/puppet/state/state.yaml]: Autorequiring File[/var/puppet/state] debug: /puppetconfig/puppetd/File[/var/puppet/state/localconfig]: Autorequiring File[/var/puppet/state] debug: /puppetconfig/puppetd/File[/var/puppet/log/puppetd.log]: Autorequiring File[/var/puppet/log] debug: /puppetconfig/puppet/File[/var/puppet/state/graphs]: Autorequiring File[/var/puppet/state] debug: /puppetconfig/puppet/File[/var/puppet/run]: Autorequiring File[/var/puppet] debug: /puppetconfig/puppet/File[/var/puppet/facts]: Autorequiring File[/var/puppet] debug: /puppetconfig/puppetd/File[/var/puppet/state/puppetdlock]: Autorequiring File[/var/puppet/state] debug: /puppetconfig/puppet/File[/var/puppet/log]: Autorequiring File[/var/puppet] debug: /puppetconfig/puppetd/File[/var/puppet/log/puppetd.log]: File does not exist debug: /puppetconfig/puppet/File[/var/puppet/facts]: File does not exist debug: /puppetconfig/puppet/File[/var/puppet/plugins]: File does not exist debug: /puppetconfig/puppetd/File[/var/puppet/state/puppetdlock]: File does not exist debug: /puppetconfig/puppet/File[/var/puppet/state/state.yaml]: Changing mode debug: /puppetconfig/puppet/File[/var/puppet/state/state.yaml]: 1 change(s) debug: /puppetconfig/puppet/File[/var/puppet/state/state.yaml]/mode: mode changed ''640'' to ''660'' debug: /puppetconfig/puppetd/File[/var/puppet/state/localconfig]: File does not exist debug: Finishing transaction 71558250 with 1 changes debug: Creating default schedules notice: Ignoring --listen on onetime run debug: Loaded state in 0.01 seconds debug: Calling puppetmaster.freshness info: Config is up to date debug: package provider rug: Not suitable: operatingsystem not in suse debug: package provider aptitude: Not suitable: missing /usr/bin/aptitude debug: package provider yum: Not suitable: missing yum debug: package provider sunfreeware: Not suitable: missing pkg-get debug: package provider portage: Not suitable: missing /usr/bin/emerge debug: package provider up2date: Not suitable: operatingsystem not in redhat debug: package provider aptrpm: Not suitable: missing /usr/bin/apt-get debug: package provider blastwave: Not suitable: missing pkg-get debug: package provider rpm: Not suitable: missing rpm debug: package provider darwinport: Not suitable: operatingsystem not in Darwin debug: package provider apple: Not suitable: missing /Library/Receipts debug: package provider apt: Not suitable: missing /usr/bin/apt-get debug: package provider pkgdmg: Not suitable: missing /Library/Receipts debug: package provider sun: Not suitable: missing /usr/sbin/pkgadd debug: package provider openbsd: Not suitable: operatingsystem not in openbsd debug: package provider gem: Not suitable: missing gem debug: package provider dpkg: Not suitable: missing /usr/bin/dpkg debug: Puppet::Network::Client::File: defining fileserver.describe debug: Puppet::Network::Client::File: defining fileserver.list debug: Puppet::Network::Client::File: defining fileserver.retrieve debug: Finishing transaction 74966320 with 0 changes debug: service provider redhat: Not suitable: missing /sbin/chkconfig notice: Starting configuration run debug: //thor/dhcp/dhcpfile[zones]/File[zones]/notify: subscribes to Exec[reload] debug: //thor/dhcp/dhcpfile[dhcpd.master]/File[dhcpd.master]/notify: subscribes to Exec[reload] debug: //thor/dhcp/dhcpfile[hosts]/File[hosts]/notify: subscribes to Exec[reload] debug: //thor/dhcp/dhcpfile[printers]/File[printers]/notify: subscribes to Exec[reload] debug: //puppet/Package[puppet-without-patch]/before: requires Package[puppet] debug: //thor/dhcp/dhcpfile[itss]/File[itss]/notify: subscribes to Exec[reload] debug: //thor/dhcp/dhcpfile[disabled]/File[disabled]/notify: subscribes to Exec[reload] debug: //thor/dhcp/dhcpfile[its]/File[its]/notify: subscribes to Exec[reload] debug: //thor/dhcp/File[/usr/local/etc/dhcpd/dhcpd.conf]/notify: subscribes to Exec[reload] debug: //thor/dhcp/dhcpfile[zones]/File[zones]: Autorequiring File[/usr/local/etc/dhcpd] debug: //thor/dhcp/dhcpfile[dhcpd.master]/File[dhcpd.master]: Autorequiring File[/usr/local/etc/dhcpd] debug: //thor/dhcp/dhcpfile[hosts]/File[hosts]: Autorequiring File[/usr/local/etc/dhcpd] debug: //thor/dhcp/dhcpfile[printers]/File[printers]: Autorequiring File[/usr/local/etc/dhcpd] debug: //thor/dhcp/dhcpfile[itss]/File[itss]: Autorequiring File[/usr/local/etc/dhcpd] debug: //thor/dhcp/dhcpfile[disabled]/File[disabled]: Autorequiring File[/usr/local/etc/dhcpd] debug: //thor/dhcp/dhcpfile[its]/File[its]: Autorequiring File[/usr/local/etc/dhcpd] debug: //thor/dhcp/File[/usr/local/etc/dhcpd/tools]: Autorequiring File[/usr/local/etc/dhcpd] debug: //thor/dhcp/File[/usr/local/etc/dhcpd/dhcpd.conf]: Autorequiring File[/usr/local/etc/dhcpd] debug: Calling fileserver.describe debug: Service[dhcpd](provider=init): Executing ''/usr/local/etc/rc.d/isc-dhcpd status'' debug: Service[dhcpd](provider=init): isc-dhcpd status returned nil debug: Calling fileserver.describe debug: package provider ports: Executing ''/usr/sbin/pkg_info'' debug: package provider ports: Executing ''/usr/sbin/pkg_info'' debug: Calling fileserver.describe debug: Calling fileserver.describe debug: Calling fileserver.list debug: Calling fileserver.describe debug: Calling fileserver.list debug: Calling fileserver.describe debug: Calling fileserver.describe debug: Calling fileserver.describe debug: Calling fileserver.describe debug: Calling fileserver.describe debug: Calling fileserver.describe debug: Calling fileserver.describe debug: Calling fileserver.describe debug: //thor/dhcp/dhcpfile[dhcpd.master]/File[dhcpd.master]: Changing source debug: //thor/dhcp/dhcpfile[dhcpd.master]/File[dhcpd.master]: 1 change(s) debug: Calling fileserver.retrieve info: Filebucket[/var/puppet/clientbucket]: Adding /usr/local/etc/dhcpd/dhcpd.master(e34e0fd393bed8dedac66874b2569210) info: //thor/dhcp/dhcpfile[dhcpd.master]/File[dhcpd.master]: Filebucketed to puppet with sum e34e0fd393bed8dedac66874b2569210 debug: //thor/dhcp/dhcpfile[dhcpd.master]/File[dhcpd.master]/checksum: Replacing dhcpd.master checksum {md5}e34e0fd393bed8dedac66874b2569210 with {md5}506daa472ed9ac2fc38da9c2823b6770 notice: //thor/dhcp/dhcpfile[dhcpd.master]/File[dhcpd.master]/source: replacing from source puppet://svn.csub.edu/dist/dhcp/dhcpd.master with contents {md5}506daa472ed9ac2fc38da9c2823b6770 info: //thor/dhcp/dhcpfile[dhcpd.master]/File[dhcpd.master]: Scheduling refresh of Exec[reload] debug: Calling fileserver.describe debug: package provider ports: Executing ''/usr/sbin/pkg_info'' debug: Calling fileserver.describe notice: //thor/dhcp/Exec[reload]: Triggering ''refresh'' from 1 dependencies debug: //thor/dhcp/Exec[reload]: Executing ''/usr/local/etc/dhcpd/tools/reload.sh /usr/local/etc/dhcpd/dhcpd.conf netops-notice@csub.edu svn-dhcp-watchers@csub.edu'' debug: Executing ''/usr/local/etc/dhcpd/tools/reload.sh /usr/local/etc/dhcpd/dhcpd.conf netops-notice@csub.edu svn-dhcp-watchers@csub.edu'' err: //thor/dhcp/Exec[reload]: Failed to call refresh on Exec[reload]: /usr/local/etc/dhcpd/tools/reload.sh /usr/local/etc/dhcpd/dhcpd.conf netops-notice@csub.edu svn-dhcp-watchers@csub.edu returned 1 instead of 0 at /usr/local/etc/puppet/manifests/modules/dhcp.pp:61 debug: package provider ports: Executing ''/usr/sbin/pkg_info'' debug: Finishing transaction 74610290 with 1 changes debug: Storing state debug: Stored state in 0.06 seconds notice: Finished configuration run in 6.18 seconds -- Russell A. Jackson <raj@csub.edu> Network Analyst California State University, Bakersfield Everyone is entitled to my opinion. _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
Russell Jackson wrote:> Digant C Kasundra wrote: >> --On Monday, July 16, 2007 02:38:22 PM -0700 Russell Jackson <raj@csub.edu> >> wrote: >> >>> Are exec resources triggered by notify events supposed to be run once for >>> every event received or only run once per run irregardless of the number >>> of resources that notified it? It seems to me that it gets run twice no >>> matter how many resources triggered it. consider the following class: >> I haven''t noticed anything exactly like that. What version are you >> running? What does the debug output look like on the client? >> > > Sorry. I should know better than to leave out information like that. > > # uname -a > FreeBSD thor.csub.edu 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Fri Jul 13 19:38:42 PDT 2007 > rjackson3@thor.csub.edu:/usr/obj/usr/src/sys/THOR i386 > > # puppet -V > 0.22.4 > > # puppetd --confdir /usr/local/etc/puppet --onetime --verbose --debug > debug: puppetd: Setting report to ''false'' > debug: puppetd: Setting runinterval to ''60'' > debug: puppetd: Setting listen to ''true'' > debug: /puppetconfig/puppet/File[/var/puppet/lib]: Autorequiring File[/var/puppet] > debug: /puppetconfig/puppet/File[/var/puppet/state]: Autorequiring File[/var/puppet] > debug: /puppetconfig/puppetd/File[/var/puppet/log/http.log]: Autorequiring > <snip>> debug: //thor/dhcp/dhcpfile[dhcpd.master]/File[dhcpd.master]: Changing source > debug: //thor/dhcp/dhcpfile[dhcpd.master]/File[dhcpd.master]: 1 change(s) > debug: Calling fileserver.retrieve > info: Filebucket[/var/puppet/clientbucket]: Adding > /usr/local/etc/dhcpd/dhcpd.master(e34e0fd393bed8dedac66874b2569210) > info: //thor/dhcp/dhcpfile[dhcpd.master]/File[dhcpd.master]: Filebucketed to puppet with > sum e34e0fd393bed8dedac66874b2569210 > debug: //thor/dhcp/dhcpfile[dhcpd.master]/File[dhcpd.master]/checksum: Replacing > dhcpd.master checksum {md5}e34e0fd393bed8dedac66874b2569210 with > {md5}506daa472ed9ac2fc38da9c2823b6770 > notice: //thor/dhcp/dhcpfile[dhcpd.master]/File[dhcpd.master]/source: replacing from > source puppet://svn.csub.edu/dist/dhcp/dhcpd.master with contents > {md5}506daa472ed9ac2fc38da9c2823b6770 > info: //thor/dhcp/dhcpfile[dhcpd.master]/File[dhcpd.master]: Scheduling refresh of > Exec[reload] > debug: Calling fileserver.describe > debug: package provider ports: Executing ''/usr/sbin/pkg_info'' > debug: Calling fileserver.describe > notice: //thor/dhcp/Exec[reload]: Triggering ''refresh'' from 1 dependencies > debug: //thor/dhcp/Exec[reload]: Executing ''/usr/local/etc/dhcpd/tools/reload.sh > /usr/local/etc/dhcpd/dhcpd.conf netops-notice@csub.edu svn-dhcp-watchers@csub.edu'' > debug: Executing ''/usr/local/etc/dhcpd/tools/reload.sh /usr/local/etc/dhcpd/dhcpd.conf > netops-notice@csub.edu svn-dhcp-watchers@csub.edu'' > err: //thor/dhcp/Exec[reload]: Failed to call refresh on Exec[reload]: > /usr/local/etc/dhcpd/tools/reload.sh /usr/local/etc/dhcpd/dhcpd.conf > netops-notice@csub.edu svn-dhcp-watchers@csub.edu returned 1 instead of 0 at > /usr/local/etc/puppet/manifests/modules/dhcp.pp:61 > debug: package provider ports: Executing ''/usr/sbin/pkg_info'' > debug: Finishing transaction 74610290 with 1 changes > debug: Storing state > debug: Stored state in 0.06 seconds > notice: Finished configuration run in 6.18 seconds >Oh jeeze. I just realized that it''s not getting exec''ed twice. I have primary and secondary dhcp servers that both run puppet, and they both run the reload script at the same time on the same set of files (almost). So, I''m getting an email from both servers. The fact that the word ''Exec'' appears twice in the debug output caused my simple mind to correlate the two :-P together. Sorry. I should have looked at the damn mail headers before crying wolf. -- Russell A. Jackson <raj@csub.edu> Network Analyst California State University, Bakersfield None love the bearer of bad news. -- Sophocles _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
Luke Kanies wrote:> This can be shortened to: > > dhcpfile { ["dhcpd.master", zones, hosts, printers, ...]: } >Ah. That''s much nicer. Thanks. -- Russell A. Jackson <raj@csub.edu> Network Analyst California State University, Bakersfield None love the bearer of bad news. -- Sophocles _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users