Puppet: System Administration Automated

Support

Ticket #766 (closed defect: fixed)

Opened 1 year ago

Last modified 9 months ago

events don't trigger a service restart when "ensure" attribute is omitted

Reported by: daneturner Assigned to: andrew
Priority: normal Milestone: misspiggy
Component: library Version: 0.23.1
Severity: normal Keywords: service restart notify subscribe
Cc: Triage Stage: Accepted
Attached Patches: Code Complexity: Unknown

Description

Events triggered by notify/subscribe don't restart a running service if the service definition omits the "ensure" attribute. Puppet should check whether the service is running, not whether the service should be running.

For example, the following *does not* restart a running myqld after my.cnf changes:

service { "mysqld": 
   name => "mysql-server",
   pattern => "mysqld",
   path => "/usr/local/etc/rc.d",
   provider => init,
}
remotefile { "/etc/my.cnf": 
   source => "apps/mysql/my.cnf,
   notify => Service[mysqld],
}

Change History

09/06/07 19:50:31 changed by michael

  • stage changed from Unreviewed to Accepted.
  • milestone set to misspiggy.

11/06/07 15:23:24 changed by DavidS

  • patch changed from None to Code.

A fix for this is available in the misspiggy/fix-766 branch available from my repo at git://git.black.co.at/puppet-bugfixes

11/09/07 01:49:24 changed by luke

I looked at this commit, and I'm not satisfied with the solution. I think a :notifiable value is unnecessary; we just need to retrieve the current state of :ensure, and then restart if the service is running. Properties work fine with no 'should' value.

Something like the following should work:

if (@parameters[:ensure] || newattr(:ensure)).retrieve == :running
  ...refresh...
end

I really would like unit tests for these, though. Ping me on IRC and we can walk through creating this solution and a test for it.

11/20/07 07:29:38 changed by luke

  • owner changed from luke to andrew.

11/29/07 01:40:02 changed by luke

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in [dedc56a6ae583daca304c053b1be8a52bcdbd13a].