Bug #1045
notify not being honored
| Status: | Closed | Start date: | ||
|---|---|---|---|---|
| Priority: | High | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | language | |||
| Target version: | 0.24.6 | |||
| Affected Puppet version: | 0.24.5 | Branch: | ||
| Keywords: | ||||
| Votes: | 0 |
Description
When using a define then using notify => Service, the service does not restart (it does not even get set to restart) however if putting the notify in the define directly it does work. I’m not sure whats causing this. Below is the working and non-working config as well as a trace. This all used to work, I’m not exactly sure when it stopped.
# DOESNT WORK
configfile { '/etc/nagios/':
source => 'system/nagios/',
owner => nagios,
group => nagios,
recurse => true,
require => Package['nagios.x86_64'],
notify => Service['nagios'],
}
define configfile($owner = root, $group = root, $mode = 644, $source,
$backup = main, $recurse = false, $ensure = file) {
file { $name:
mode => $mode,
owner => $owner,
group => $group,
backup => $backup,
recurse => $recurse,
ensure => $ensure,
source => "puppet:///config/$source"
}
}
#END
#DOES WORK
nagiosfile { '/etc/nagios/':
source => 'system/nagios/',
owner => nagios,
group => nagios,
recurse => true,
require => Package['nagios.x86_64'],
}
define nagiosfile($owner = root, $group = root, $mode = 644, $source,
$backup = main, $recurse = false, $ensure = file) {
file { $name:
mode => $mode,
owner => $owner,
group => $group,
backup => $backup,
recurse => $recurse,
ensure => $ensure,
notify => Service['nagios'],
source => "puppet:///config/$source"
}
}
#END
#TRACE OF NON WORKING (notice on restart)
info: /Host[puppet.fedoraproject.org]: Adding aliases "puppet"
info: /Host[puppet.fedoraproject.org]: Adding aliases "puppet1"
info: /Host[puppet.fedoraproject.org]: Adding aliases "puppet1.fedora.phx.redhat.com"
info: Caching catalog at /var/lib/puppet/localconfig.yaml
notice: Starting catalog run
notice: //Node[noc1]/noc/nagios-server/Configfile[/etc/nagios/]/File[/etc/nagios/services]/checksum: checksum changed '{time}Mon Feb 04 21:47:16 -0700 2008' to '{time}Mon Feb 04 22:16:18 -0700 2008'
2d1
<
notice: //Node[noc1]/noc/nagios-server/Configfile[/etc/nagios/]/File[/etc/nagios/services/websites.cfg]/checksum: checksum changed '{md5}cf1b00727c3126543c2512d6c4217789' to '{md5}3ba83016aa09c12229928f90b10c421e'
info: //Node[noc1]/noc/nagios-server/Configfile[/etc/nagios/]/File[/etc/nagios/services/websites.cfg]: Filebucketed to main with sum 3ba83016aa09c12229928f90b10c421e
notice: //Node[noc1]/noc/nagios-server/Configfile[/etc/nagios/]/File[/etc/nagios/services/websites.cfg]/source: replacing from source puppet:///config/system/nagios/services/websites.cfg with contents {md5}cf1b00727c3126543c2512d6c4217789
notice: Finished catalog run in 38.78 seconds
#END
History
Updated by Luke Kanies about 4 years ago
I’ll try to get this into 0.24.2, but considering it’s got easy workarounds, it might slip.
Updated by Mike McGrath about 4 years ago
Its an easy workaround, but then I have to create a bunch of defines even if its only one config file. For stuff like syslog, our torrents, dns, mail, ssh, etc. All of those only use configfile with a notify => and none of them work right now but used to.
Updated by Brenton Leanhardt almost 4 years ago
I’m using puppet-0.24.1-1.fc8 and I’m not able to reproduce the problem. I’m attaching my test manifest (that attempts to model the example mentioned in the bug).
Here’s the output from the run:
[root@tumbolia tmp]# puppet test.pp <snip…> notice: //Configfile[/var/tmp/foo]/File[/var/tmp/foo/syntax/eruby.vim]/ensure: created notice: //Configfile[/var/tmp/foo]/File[/var/tmp/foo/syntax/ruby.vim]/ensure: created notice: //Configfile[/var/tmp/foo]/File[/var/tmp/foo/syntax/puppet.vim]/ensure: created notice: //Service[nfs]: Triggering ‘refresh’ from 17 dependencies
Updated by Mike McGrath almost 4 years ago
well shoot, perhaps I’ll have to start stripping things out of our configs until we get it working.
Updated by daikinee - almost 4 years ago
Changing all the recipes is not an easy workaround when you have a define for config file like mmcgrath or me. Prevents me for switching to 0.24.1 version.
Updated by Brice Figureau almost 4 years ago
It also fails to honor “before”, but seems to honor “require”.
Unfortunately I’m a big fan of David Schmitt’s concatenated_file define to produce large config files from separate snippets (some of them also generated by concatenated_file) and while it was working fine under 0.23 it miserably fails under 0.24.1 (currently lenny debian version).
I’ll upload a test based on David Schmitt’s concatenated_file showing the issue.
Updated by AJ Christensen almost 4 years ago
Unable to replicate here. Git 0.24.x HEAD as of earlier today (fd1573fdb696803deb7a220d6bfd06b8afff55fb)
manifest:
#!/usr/bin/env puppet
service {
apache2:
ensure => running, enable => true;
}
package {
apache2:
ensure => installed;
}
configfile { "/tmp/apache/":
source => "apache/",
owner => "www-data",
group => "www-data",
recurse => true,
require => Package[apache2],
notify => Service[apache2],
}
define configfile($owner = root, $group = root, $mode = 644, $source,
$recurse = false, $ensure = file) {
file { $name:
mode => $mode,
owner => $owner,
group => $group,
recurse => $recurse,
ensure => $ensure,
source => "puppet:///$source"
}
}
apache2 not running:
root@junglist /tmp# ps aux|grep apache
root 6716 1.3 2.8 22404 7324 ? Ss 20:30 0:00 /usr/sbin/apache2 -k start
www-data 6723 0.0 1.5 22404 3860 ? S 20:30 0:00 /usr/sbin/apache2 -k start
www-data 6724 0.0 1.5 22404 3856 ? S 20:30 0:00 /usr/sbin/apache2 -k start
www-data 6725 0.0 1.5 22404 3856 ? S 20:30 0:00 /usr/sbin/apache2 -k start
www-data 6726 0.0 1.5 22404 3856 ? S 20:30 0:00 /usr/sbin/apache2 -k start
www-data 6727 0.0 1.5 22404 3856 ? S 20:30 0:00 /usr/sbin/apache2 -k start
root 6744 0.0 0.2 2972 748 pts/8 R+ 20:30 0:00 grep apache
root@junglist /tmp# /etc/init.d/apache2 stop
* Stopping web server apache2
[Fri Feb 29 20:30:44 2008] [warn] _default_ [[VirtualHost]] overlap on port 443, the first has precedence
[Fri Feb 29 20:30:44 2008] [warn] [[NameVirtualHost]] *:80 has no [[VirtualHosts]]
...done.
root@junglist /tmp# ps aux|grep apache
root 6761 0.0 0.2 2976 748 pts/8 R+ 20:30 0:00 grep apache
root@junglist /tmp# ./test.pp --debug
debug: Puppet::Type::Service::ProviderGentoo: Not suitable: missing /sbin/rc-update
debug: Puppet::Type::Service::ProviderRedhat: Not suitable: missing /sbin/chkconfig
debug: Puppet::Type::Service::ProviderSmf: Not suitable: missing /usr/sbin/svcadm
debug: Defining notify on Configfile[/tmp/apache/]
debug: Defining require on Configfile[/tmp/apache/]
debug: Puppet::Type::Package::ProviderFreebsd: Not suitable: operatingsystem not in freebsd
debug: Puppet::Type::Package::ProviderFink: Not suitable: missing /sw/bin/fink
debug: Puppet::Type::Package::ProviderSun: Not suitable: missing /usr/sbin/pkgrm
debug: Puppet::Type::Package::ProviderSunfreeware: Not suitable: missing pkg-get
debug: Puppet::Type::Package::ProviderOpenbsd: Not suitable: operatingsystem not in openbsd
debug: Puppet::Type::Package::ProviderUrpmi: Not suitable: missing urpmi
debug: Puppet::Type::Package::ProviderPorts: Not suitable: missing /usr/sbin/pkg_info
debug: Puppet::Type::Package::ProviderApple: Not suitable: missing /Library/Receipts
debug: Puppet::Type::Package::ProviderRpm: Not suitable: missing rpm
debug: Puppet::Type::Package::ProviderPkgdmg: Not suitable: missing /Library/Receipts
debug: Puppet::Type::Package::ProviderDarwinport: Not suitable: operatingsystem not in Darwin
debug: Puppet::Type::Package::ProviderAppdmg: Not suitable: missing /Library/Receipts
debug: Puppet::Type::Package::ProviderUp2date: Not suitable: operatingsystem not in redhat
debug: Puppet::Type::Package::ProviderAptrpm: Not suitable: missing rpm
debug: Puppet::Type::Package::ProviderYum: Not suitable: missing rpm
debug: Puppet::Type::Package::ProviderBlastwave: Not suitable: missing pkg-get
debug: Puppet::Type::Package::ProviderPortage: Not suitable: missing /usr/bin/emerge
debug: Puppet::Type::Package::ProviderRug: Not suitable: operatingsystem not in suse
info: mount[localhost]: Mounted /
info: mount[modules]: Mounted
info: mount[plugins]: Mounted
debug: Creating default schedules
debug: Finishing transaction -609578828 with 0 changes
debug: Prefetching apt resources for package
debug: Executing '/usr/bin/dpkg-query -W --showformat '${Status} ${Package} ${Version}\n_
debug: Puppet::Type::Package::ProviderApt: Executing '/usr/bin/dpkg-query -W --showformat '${Status} ${Package} ${Version}\n_
debug: //Configfile[/tmp/apache/]/File[/tmp/apache]/require: requires Package[apache2]
debug: //Configfile[/tmp/apache/]/require: requires Package[apache2]
debug: //Configfile[/tmp/apache/]/notify: subscribes to Service[apache2]
debug: Finishing transaction -610306788 with 0 changes
debug: //Configfile[/tmp/apache/]/File[/tmp/apache]/checksum: Initializing checksum hash
debug: //Configfile[/tmp/apache/]/File[/tmp/apache]: Creating checksum {mtime}Fri Feb 29 20:30:21 +1300 2008
debug: //Configfile[/tmp/apache/]/File[/tmp/apache/junglist.gen.nz]/checksum: Initializing checksum hash
debug: //Configfile[/tmp/apache/]/File[/tmp/apache/junglist.gen.nz]: Creating checksum {md5}b80f7095ddef38646823571c08957a6b
debug: Service[apache2](provider=debian): Executing 'ps -ef'
debug: Puppet::Type::Service::ProviderDebian: Executing '/usr/sbin/update-rc.d -n -f apache2 remove'
debug: //Service[apache2]: Changing ensure
debug: //Service[apache2]: 1 change(s)
debug: Service[apache2](provider=debian): Executing '/etc/init.d/apache2 start'
debug: Puppet::Type::Service::ProviderDebian: Executing '/usr/sbin/update-rc.d -n -f apache2 remove'
notice: //Service[apache2]/ensure: ensure changed 'stopped' to 'running'
debug: Finishing transaction -610097588 with 1 changes
debug: //Configfile[/tmp/apache/]/File[/tmp/apache]/require: requires Package[apache2]
debug: //Configfile[/tmp/apache/]/require: requires Package[apache2]
debug: //Configfile[/tmp/apache/]/notify: subscribes to Service[apache2]
apache2 running, /tmp/apache/ missing:
root@junglist /tmp# rm -rf apache/
root@junglist /tmp# ls
bug219.patch esets.sock puppetd.log sqlsMAMoZ test.pp
root@junglist /tmp# ./test.pp --debug
debug: Puppet::Type::Package::ProviderFreebsd: Not suitable: operatingsystem not in freebsd
debug: Puppet::Type::Package::ProviderFink: Not suitable: missing /sw/bin/fink
debug: Puppet::Type::Package::ProviderSun: Not suitable: missing /usr/sbin/pkgrm
debug: Puppet::Type::Package::ProviderSunfreeware: Not suitable: missing pkg-get
debug: Puppet::Type::Package::ProviderOpenbsd: Not suitable: operatingsystem not in openbsd
debug: Puppet::Type::Package::ProviderUrpmi: Not suitable: missing urpmi
debug: Puppet::Type::Package::ProviderPorts: Not suitable: missing /usr/sbin/pkg_info
debug: Puppet::Type::Package::ProviderApple: Not suitable: missing /Library/Receipts
debug: Puppet::Type::Package::ProviderRpm: Not suitable: missing rpm
debug: Puppet::Type::Package::ProviderPkgdmg: Not suitable: missing /Library/Receipts
debug: Puppet::Type::Package::ProviderDarwinport: Not suitable: operatingsystem not in Darwin
debug: Puppet::Type::Package::ProviderAppdmg: Not suitable: missing /Library/Receipts
debug: Puppet::Type::Package::ProviderUp2date: Not suitable: operatingsystem not in redhat
debug: Puppet::Type::Package::ProviderAptrpm: Not suitable: missing rpm
debug: Puppet::Type::Package::ProviderYum: Not suitable: missing rpm
debug: Puppet::Type::Package::ProviderBlastwave: Not suitable: missing pkg-get
debug: Puppet::Type::Package::ProviderPortage: Not suitable: missing /usr/bin/emerge
debug: Puppet::Type::Package::ProviderRug: Not suitable: operatingsystem not in suse
debug: Puppet::Type::Service::ProviderGentoo: Not suitable: missing /sbin/rc-update
debug: Puppet::Type::Service::ProviderRedhat: Not suitable: missing /sbin/chkconfig
debug: Puppet::Type::Service::ProviderSmf: Not suitable: missing /usr/sbin/svcadm
debug: Defining notify on Configfile[/tmp/apache/]
debug: Defining require on Configfile[/tmp/apache/]
info: mount[localhost]: Mounted /
info: mount[modules]: Mounted
info: mount[plugins]: Mounted
debug: Creating default schedules
debug: Finishing transaction -609905178 with 0 changes
debug: Prefetching apt resources for package
debug: Executing '/usr/bin/dpkg-query -W --showformat '${Status} ${Package} ${Version}\n_
debug: Puppet::Type::Package::ProviderApt: Executing '/usr/bin/dpkg-query -W --showformat '${Status} ${Package} ${Version}\n_
debug: //Configfile[/tmp/apache/]/require: requires Package[apache2]
debug: //Configfile[/tmp/apache/]/notify: subscribes to Service[apache2]
debug: //Configfile[/tmp/apache/]/File[/tmp/apache]/require: requires Package[apache2]
debug: Finishing transaction -610646818 with 0 changes
debug: //Configfile[/tmp/apache/]/File[/tmp/apache]: File does not exist
debug: //Configfile[/tmp/apache/]/File[/tmp/apache]: Changing ensure
debug: //Configfile[/tmp/apache/]/File[/tmp/apache]: 1 change(s)
debug: //Configfile[/tmp/apache/]/File[/tmp/apache]/checksum: Initializing checksum hash
debug: //Configfile[/tmp/apache/]/File[/tmp/apache]: Creating checksum {mtime}Fri Feb 29 20:32:56 +1300 2008
notice: //Configfile[/tmp/apache/]/File[/tmp/apache]/ensure: created
debug: //Configfile[/tmp/apache/]/File[/tmp/apache/junglist.gen.nz]: File does not exist
debug: //Configfile[/tmp/apache/]/File[/tmp/apache/junglist.gen.nz]: Changing ensure
debug: //Configfile[/tmp/apache/]/File[/tmp/apache/junglist.gen.nz]: 1 change(s)
debug: //Configfile[/tmp/apache/]/File[/tmp/apache/junglist.gen.nz]/checksum: Initializing checksum hash
debug: //Configfile[/tmp/apache/]/File[/tmp/apache/junglist.gen.nz]: Creating checksum {md5}b80f7095ddef38646823571c08957a6b
notice: //Configfile[/tmp/apache/]/File[/tmp/apache/junglist.gen.nz]/ensure: created
info: //Configfile[/tmp/apache/]/File[/tmp/apache]: Scheduling refresh of Service[apache2]
info: //Configfile[/tmp/apache/]/File[/tmp/apache]: Scheduling refresh of Service[apache2]
debug: Service[apache2](provider=debian): Executing 'ps -ef'
debug: Service[apache2](provider=debian): PID is 6962
debug: Puppet::Type::Service::ProviderDebian: Executing '/usr/sbin/update-rc.d -n -f apache2 remove'
notice: //Service[apache2]: Triggering 'refresh' from 2 dependencies
debug: Service[apache2](provider=debian): Executing 'ps -ef'
debug: Service[apache2](provider=debian): PID is 6962
debug: Service[apache2](provider=debian): Executing '/etc/init.d/apache2 stop'
debug: Service[apache2](provider=debian): Executing '/etc/init.d/apache2 start'
debug: Finishing transaction -610423938 with 2 changes
debug: //Configfile[/tmp/apache/]/require: requires Package[apache2]
debug: //Configfile[/tmp/apache/]/notify: subscribes to Service[apache2]
debug: //Configfile[/tmp/apache/]/File[/tmp/apache]/require: requires Package[apache2]
root@junglist /tmp# tail -f /var/log/apache2/error.log
[Fri Feb 29 20:32:24 2008] [error] (9)Bad file descriptor: apr_socket_accept: (client socket)
[Fri Feb 29 20:32:24 2008] [error] (9)Bad file descriptor: apr_socket_accept: (client socket)
[Fri Feb 29 20:32:25 2008] [notice] Apache/2.2.4 (Ubuntu) PHP/5.2.3-1ubuntu6.3 mod_ssl/2.2.4 [[OpenSSL]]/0.9.8e configured -- resuming normal operations
[Fri Feb 29 20:32:57 2008] [notice] caught SIGWINCH, shutting down gracefully
[Fri Feb 29 20:32:57 2008] [error] (9)Bad file descriptor: apr_socket_accept: (client socket)
[Fri Feb 29 20:32:57 2008] [error] (9)Bad file descriptor: apr_socket_accept: (client socket)
[Fri Feb 29 20:32:57 2008] [error] (9)Bad file descriptor: apr_socket_accept: (client socket)
[Fri Feb 29 20:32:57 2008] [error] (9)Bad file descriptor: apr_socket_accept: (client socket)
[Fri Feb 29 20:32:57 2008] [error] (9)Bad file descriptor: apr_socket_accept: (client socket)
[Fri Feb 29 20:32:57 2008] [notice] Apache/2.2.4 (Ubuntu) PHP/5.2.3-1ubuntu6.3 mod_ssl/2.2.4 [[OpenSSL]]/0.9.8e configured -- resuming normal operations
Updated by Luke Kanies almost 4 years ago
- Status changed from 1 to Closed
- 7 set to worksforme
Looks like no one can reproduce this, so I’m closing it unless someone has a more clear-cut example.
Updated by Sébastien Prud'homme over 3 years ago
- Status changed from Closed to Re-opened
- Priority changed from Normal to High
- Target version deleted (
0.24.2) - Affected Puppet version set to 0.24.5
I reopen the bug as i have the same problem. I’ve noticed that if i use only a “notify” in the define instance it works fine, but if i use both a “notify” and a “require” the “notify” is not taken into account.
I’ve checked the localconfig.yaml and it confirms the bug.
For instance this first example does'nt work
myfile { "/etc/ssh/sshd_config":
mode => 600,
owner => root,
group => root,
section => "systeme/commun",
require => Mypackage[openssh-server],
notify => Service[sshd]
}
generates this YAML configuration (the “notify” is missing")
- !ruby/object:Puppet::TransBucket
name: /etc/ssh/sshd_config
children:
- !ruby/object:Puppet::TransObject
tags:
- file
- myfile
- class
- openssh
- base
- node
- bulbul.rmap.auzeville.agri
- main
params:
ignore: .svn
purge: false
recurse: false
backup: main
mode: "600"
ensure: file
owner: root
path: /etc/ssh/sshd_config
group: root
require:
- Mypackage
- openssh-server
source: puppet://puppet.rmap.auzeville.agri/files/systeme/commun/etc/ssh/sshd_config
name: /etc/ssh/sshd_config
file: /etc/puppet/manifests/puppet.pp
type: file
line: 29
type: Myfile
but this second example work (it doesn’t use the “require”)
myfile { "/etc/ssh/sshd_config":
mode => 600,
owner => root,
group => root,
section => "systeme/commun",
notify => Service[sshd]
}
it génerated this YAML file (the “notify” is there):
- !ruby/object:Puppet::TransBucket
name: openssh
children:
- !ruby/object:Puppet::TransBucket
name: /etc/ssh/sshd_config
children:
- !ruby/object:Puppet::TransObject
tags:
- file
- myfile
- class
- openssh
- base
- node
- bulbul.rmap.auzeville.agri
- main
params:
ignore: .svn
purge: false
recurse: false
backup: main
mode: "600"
ensure: file
owner: root
path: /etc/ssh/sshd_config
group: root
notify:
- service
- sshd
source: puppet://puppet.rmap.auzeville.agri/files/systeme/commun/etc/ssh/sshd_config
name: /etc/ssh/sshd_config
file: /etc/puppet/manifests/puppet.pp
type: file
line: 29
type: Myfile
Updated by devink - over 3 years ago
- File test.pp added
I’m also observing the same bug. So far what I’ve been able to piece together: * It only seems to occur when running the manifest through a puppetmasterd. I cannot reproduce it just using “puppet”. * It seems that if there is a require or before parameter into a defined resource then the notify parameter doesn’t get picked up and transferred through to the node. * If you don’t use a defined resource (i.e. just “file” instead of “myfile”) then both the notify and before parameters will get picked up.
I’ve attached a fairly complete example which demonstrates the buggy behavior, with a few variants. The two resources “works-1” and “works-2” both work as expected, with the notify triggering the “test_exec” resource. However, neither “fails-1” or “fails-2” causes the “test_exec” resource to be triggered.
Hopefully this provides a more clear example which lets someone more familiar with the puppet internals to reproduce the bug.
Thanks, -devink
Updated by Luke Kanies over 3 years ago
- Target version set to 0.24.6
Updated by Luke Kanies over 3 years ago
Seems to work for me:
info: Caching catalog at /tmp/notify/state/localconfig.yaml notice: Starting catalog run notice: //Node[default]/test_class/Myfile[fails-2]/File[fails-2]/ensure: created notice: //Node[default]/test_class/Myfile[works-1]/File[works-1]/ensure: created info: //Node[default]/test_class/Myfile[works-1]/File[works-1]: Scheduling refresh of Exec[test_exec] notice: //Node[default]/test_class/File[works-2]/ensure: created info: //Node[default]/test_class/File[works-2]: Scheduling refresh of Exec[test_exec] notice: //Node[default]/test_class/Myfile[fails-1]/File[fails-1]/ensure: created notice: //Node[default]/test_class/Exec[test_exec]: Triggering 'refresh' from 2 dependencies notice: Finished catalog run in 1.01 seconds
I’m guessing it’s some kind of weird ordering issue internally, where it sometimes works and sometimes fails.
I’ll look at it just a bit more and see what I can see.
Updated by Luke Kanies over 3 years ago
- Category set to language
- Status changed from Re-opened to Ready For Checkin
- Assignee changed from Puppet Community to James Turnbull
I think I found the problem and fixed it in the tickets/0.24.x/1045 branch in my repo. Please test and verify that it’s working for you.
The problem was that I was using ‘return’ in a loop when I should have been using ‘next’.
Updated by James Turnbull over 3 years ago
- Status changed from Ready For Checkin to Closed
Pushed in commit:0040bc87a1a4afac3a97165cd2e6e3c38f373261 in branch 0.24.x
Updated by devink - over 3 years ago
Just got a chance to test the new code. Puppet is refreshing test_exec from all four resource definitions as expected, so that fixed the problem. Thanks.
-devink