Skip to content
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

Merged
merged 1 commit into from
Jun 13, 2018
Merged

(MODULES-7197) Remove unused ensurable values #55

merged 1 commit into from
Jun 13, 2018

Conversation

michaeltlombardi
Copy link
Contributor

@michaeltlombardi michaeltlombardi commented Jun 12, 2018

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.

ThoughtCrhyme
ThoughtCrhyme previously approved these changes Jun 12, 2018
@michaeltlombardi
Copy link
Contributor Author

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 present).

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.
Copy link
Contributor

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.

@@ -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.
Copy link
Contributor

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.
@glennsarti
Copy link
Contributor

Trap is clean

@glennsarti glennsarti merged commit c214c5a into puppetlabs:master Jun 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants