Issue #4111 has been updated by Thomas Linkin.

Status changed from Accepted to In Topic Branch Pending Review
Target version deleted (2.7.x)

Branch: https://github.com/puppetlabs/puppet/pull/872

In the beginning, there was ensure. And for a time, it was good.

I recently have been trying to write a custom type, and have been caught by 
this very issue. I understand the original concept, where 'Ensure' is the king 
of properties, however, in practice has not always been the case. For starters, 
using ensure is optional, so making the behaviour of properties in its presence 
so rigid seems troublesome. Additionally, I have caught the 'hack' mentioned 
above being used in the 'Service' type in puppet core. In the 'Service' type, 
the enable property is being brought in sync by the ensure property, when the 
ensure is being brought in sync.

Overall, I need to agree with option 2 from above. While I understand what 
'ensure' is trying to do, I think we need more flexibility. Any types that take 
advantage of the 'hack' mentioned above miss out on having the changes to the 
system reported or audited.

I have included a possible solution. It allows you to designate properties as 
being "independent" from the ensure property. I went this route because most of 
the concepts behind why ensure works the way it does are logical and sound. In 
the interest of preserving this logic, the change maintains that ensure is 
always the first property to be brought in sync. The change is also backwards 
compatible with the 'hack' that was mentioned above.

----------------------------------------
Bug #4111: If "ensure" changes, then no other changes are reported for that 
resource.
https://projects.puppetlabs.com/issues/4111#change-65537

Author: Dan Bode
Status: In Topic Branch Pending Review
Priority: High
Assignee: 
Category: service
Target version: 
Affected Puppet version: 
Keywords: 
Branch: 


code:
<pre>
service { 'httpd':
  ensure => running,
  enable => true,
}
</pre>

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

<pre>
# /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]# 
</pre>


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to