-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(MODULES-7197) Remove unused ensurable values #55
(MODULES-7197) Remove unused ensurable values #55
Conversation
|
Note: This doesn't change the name of the ensurable property default value, but it does remove extraneous ones and document why there's only one/advise folks not to specify it in their manifest. Future work to change the name will have to come (if at all) after we figure out how to make the reporting better (since by default puppet declares a resource which is in the desired state as |
README.md
Outdated
| @@ -287,6 +287,11 @@ The `dsc` type allows specifying any DSC Resource declaration as a minimal Puppe | |||
|
|
|||
| The name of the declaration. This has no affect on the DSC Resource declaration and is not used by the DSC Resource. | |||
|
|
|||
| #### ensure | |||
|
|
|||
| A necessary property to cause puppet to invoke the dsc resource if required. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not keen on this. Perhaps
An optional property that specifies that the DSC resource should be invoked. This property has only one value of `present`. This property does not need be be set in manifests.
lib/puppet/type/dsc.rb
Outdated
| @@ -5,9 +5,17 @@ | |||
| require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_lite/dsc_type_helpers' | |||
|
|
|||
| ensurable do | |||
| newvalue(:exists?) { provider.exists? } | |||
| desc <<-HERE | |||
| A necessary property to cause puppet to invoke the dsc resource if required. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per comment in README
Prior to this commit the ensure property included an option for users to specify `absent` on the resource which may not actually match up with the DSC properties and which follows the same code path as `present` in any case. The ensure property also included `exists?` as a valid value, even though setting it provided no functionality for users. This commit removes the code to support the `absent` and `exists?` values in the type and the `absent` value in the provider. The `exists?` codepath is still called before puppet runs the `create` code path, and only runs `create` if the returned value from `exists?` is `false`. Further, this commit removes the ensure tests from the acceptance test suite. These tests verified functionality when the dsc and puppet `ensure` properties were in conflict. As of this commit there is only one valid value for `ensure` on the puppet resource so these tests are no longer needed. Finally, this commit adds documentation to the `ensure` property and some comments to clarify why we did not change the name of the ensurable value (reporting). A future commit which addresses the reporting problems may also allow us to update the ensurable value from 'present' to something like 'invoke' which is more semantically accurate.

Prior to this commit the ensure property included an
option for users to specify
absenton the resourcewhich may not actually match up with the DSC properties
and which follows the same code path as
presentinany case. The ensure property also included
exists?as a valid value, even though setting it provided no
functionality for users.
This commit removes the code to support the
absentand
exists?values in the type and theabsentvalue in the provider. The
exists?codepath is stillcalled before puppet runs the
createcode path, andonly runs
createif the returned value fromexists?is
false.Further, this commit removes the ensure tests from the
acceptance test suite. These tests verified functionality
when the dsc and puppet
ensureproperties were inconflict. As of this commit there is only one valid value
for
ensureon the puppet resource so these tests are nolonger needed.
Finally, this commit adds documentation to the
ensureproperty and some comments to clarify why we did not
change the name of the ensurable value (reporting).
A future commit which addresses the reporting problems
may also allow us to update the ensurable value from
'present' to something like 'invoke' which is more
semantically accurate.