puppetlabs/puppet — pull request #872 by trlinkin (2012-06-21 19:15:43+00:00)
Title: (#4111) Add option to change properties when 'ensure' changes

This commit will add the ability to mark a general property as independent from the :ensure
property. This is being done to modify the behavior that currently exists in the way general
properties are handled in the presence of the :ensure property. Currently, if the :ensure property
is :absent or out of sync, no other properties will be processed. This means properties that
do not rely on the status of :ensure will not be processed.

As an example, currently there is a workaround in place. This workaround is seen in the
core 'service' type.The :enable property does not rely on :ensure. In the :ensure property,
there is code that will manually sync the :enable property when :ensure is out of sync. This
is a problem because the change is never reported. The event can't be recorded or audited.

This new functionality is achieved by adding an option to the `newproperty` function in the
Type class. The :independent option will add the property to a list in the type class that
will track independent properties. It will only accept the value of :true, and will have no effect
on the :ensure property. The ResourceHarness class was modified to process the independent property
list if the :ensure property is changed or is :absent. To help preserve the behavior of the :ensure
property, independent properties will always be processed after the :ensure property. This is
similar to how property processing was ordered before this commit.

Example: newproperty(:example, :independent => true)

This change is backwards compatible with the previous method of processing independent
properties. Also, properties dependent of the :ensure property will not have their behavior
modified in this change.

This commit includes new unit tests that this change has passed on. It has also passed on the
unit tests already in place for the modified classes.