Bug #4111

If "ensure" changes, then no other changes are reported for that resource.

Added by Dan Bode almost 2 years ago. Updated about 1 year ago.

Status:Accepted Start date:07/01/2010
Priority:High Due date:
Assignee:- % Done:

0%

Category:service
Target version:2.7.x
Affected Puppet version: Branch:
Keywords:
Votes: 0

Description

code:

service { 'httpd':
  ensure => running,
  enable => true,
}

even though chkconfig is set to off in both cases, its only logged when the process isn’t started.

# /sbin/service httpd stop
Stopping httpd:                                            [  OK  ]
[root@dannyboy manifests]# chkconfig httpd off
[root@dannyboy manifests]# puppet myservice.pp 
notice: //Service[httpd]/ensure: ensure changed 'stopped' to 'running'
[root@dannyboy manifests]# chkconfig httpd off
[root@dannyboy manifests]# puppet myservice.pp 
notice: //Service[httpd]/enable: enable changed 'false' to 'true'
[root@dannyboy manifests]# 

Related issues

duplicated by Puppet - Bug #5991: Mounttype doesnt report changes when ensure changes Duplicate 01/24/2011

History

Updated by James Turnbull almost 2 years ago

  • Category set to service
  • Status changed from Unreviewed to Accepted
  • Assignee set to Jesse Wolfe
  • Priority changed from Normal to High
  • Target version set to 2.6.0
  • Affected Puppet version changed from 0.25.5 to 2.6alpha1

Updated by Jesse Wolfe almost 2 years ago

  • Subject changed from service does not log event for chkconfig update if service was started to If "ensure" changes, then no other changes are reported for that resource.

Updated by Jesse Wolfe almost 2 years ago

  • Status changed from Accepted to Needs Decision
  • Target version changed from 2.6.0 to 2.7.x

Updated by Jesse Wolfe almost 2 years ago

This is exacerbated in the case of Service in that service’s “ensure” is doing things other than absent/present.

Updated by James Turnbull about 1 year ago

  • Status changed from Needs Decision to Accepted
  • Affected Puppet version deleted (2.6alpha1)

Updated by James Turnbull about 1 year ago

  • Status changed from Accepted to Needs Decision
  • Assignee changed from Jesse Wolfe to Nigel Kersten

Updated by Nigel Kersten about 1 year ago

  • Status changed from Needs Decision to Accepted
  • Assignee deleted (Nigel Kersten)

Updated by Stefan Schulte about 1 year ago

The reason is that we treat the ensure property very special: We always sync ensure first and if ensure is outofsync, we’ll only sync ensure and expect that everything is ok afterwards. This is wrong for every type with properties that do not depend on the ensure property. Another example is the mounttype. If we change ensure from unmounted to mounted we wont report any other change (added #5991 as duplicate).

Currently the only reason why enable is synced at all in the above example is that within the ensure block of the service type puppet tests if the enable property is out of sync.

Possible solution:

  • keep the current “hack” (sync enable within ensure) but add reporting functionality
  • treat ensure as any other property. This will definitly break most of the current types (user, group, host, etc.). We can fix these again if we introduce a new method/flag for properties that says “if you sync me, other properties are automatically in sync”
  • treat ensure special but only stop syncing other properties if ensure was changed to :absent OR ensure was :absent before the change. (This may also break current types like file when ensure changes from file to link but I’m not entirely sure)

Personally, I believe that 2 is the cleanest solution, but I bet there are custom types out there that depend on the current behaviour.

Also available in: Atom PDF