-
Notifications
You must be signed in to change notification settings - Fork 41
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
(PDK-1007) implement enough to support purge=>true #95
Conversation
6492278
to
bf7c185
Compare
The code coverage failure seems to be only empty lines. |
6310c97
to
f0605ca
Compare
rebased to master |
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.
Looks great :)
expect(stdout_str.strip).to match %r{ensure\s*=> \'present\'} | ||
expect(status).to eq 0 | ||
end | ||
# it 'returns the match if title matches a namevar value' do |
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.
perhaps a comment to say why this is commented out rather than removed?
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.
re-activated them
spec/acceptance/namevar_spec.rb
Outdated
expect(stdout_str.strip).to match %r{ensure\s*=> \'present\'} | ||
expect(status).to eq 0 | ||
end | ||
# it 'returns the match if title matches a namevar value' do |
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.
same here
@@ -1,7 +1,7 @@ | |||
# Puppet::ResourceApi [![TravisCI Build Status](https://travis-ci.org/puppetlabs/puppet-resource_api.svg?branch=master)](https://travis-ci.org/puppetlabs/puppet-resource_api) [![Appveyor Build status](https://ci.appveyor.com/api/projects/status/8o9s1ax0hs8lm5fd/branch/master?svg=true)](https://ci.appveyor.com/project/puppetlabs/puppet-resource-api/branch/master) | |||
[![codecov](https://codecov.io/gh/puppetlabs/puppet-resource_api/branch/master/graph/badge.svg)](https://codecov.io/gh/puppetlabs/puppet-resource_api) | |||
|
|||
This is an implementation of the [Resource API](https://github.com/DavidS/puppet-specifications/blob/resourceapi/language/resource-api/README.md) proposal. Find a working example of a new-style provider in the [experimental puppetlabs-apt branch](https://github.com/DavidS/puppetlabs-apt/blob/resource-api-experiments/lib/puppet/provider/apt_key2/apt_key2.rb). There is also the corresponding [type](https://github.com/DavidS/puppetlabs-apt/blob/resource-api-experiments/lib/puppet/type/apt_key2.rb), [provider](https://github.com/DavidS/puppetlabs-apt/blob/resource-api-experiments/lib/puppet/provider/apt_key2/apt_key2.rb), and [new unit tests](https://github.com/DavidS/puppetlabs-apt/blob/resource-api-experiments/spec/unit/puppet/provider/apt_key2/apt_key2_spec.rb) for 100% coverage. | |||
This is an implementation of the [Resource API](https://github.com/puppetlabs/puppet-specifications/blob/master/language/resource-api/README.md) proposal. Find a working example of a new-style provider in the [experimental puppetlabs-apt branch](https://github.com/DavidS/puppetlabs-apt/blob/resource-api-experiments/lib/puppet/provider/apt_key2/apt_key2.rb). There is also the corresponding [type](https://github.com/DavidS/puppetlabs-apt/blob/resource-api-experiments/lib/puppet/type/apt_key2.rb), [provider](https://github.com/DavidS/puppetlabs-apt/blob/resource-api-experiments/lib/puppet/provider/apt_key2/apt_key2.rb), and [new unit tests](https://github.com/DavidS/puppetlabs-apt/blob/resource-api-experiments/spec/unit/puppet/provider/apt_key2/apt_key2_spec.rb) for 100% coverage. |
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.
Looks like another reference on line 179 that requires updating as well
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.
indeed!
This commit adds a property to make sure that what we get output is what we asked for in the first place.
To allow the `resources` type to purge resource instances, the `instances` method needs to return full `Puppet::Type` object instances. This commit changes the Resource API's definition of the `instances` method to do so, and fix up all adjacent issues. As of yet, this code still fails tests because it is not passing on the "current" values to the `Puppet::Type` instances returned. Instead `get` gets called through retrieve for each individual instance, causing both performance issues and test failures.
With `--strict=error`, `puppet resource` would not work. The fix of PDK-1007 now uncovered this. Therefore this commit only checks that `puppet resource` succeeds on `--strict=off`.
With the last few changes the rsapi would call into get multiple times for a type during a single run. This commit now pulls the retrieval of the current state into `refresh_current_state` and leaves the caching vs calling decision up to the caller. As a side-effect the strict get-returns-canonical-values check now runs at a time when puppet is not aborting the transaction for errors, and the "exercising a device provider using `puppet resource` with strict checking at error level deals with canonicalized resources correctly" test case does not produce a non-zero exit code anymore. Since now the state of the resource is correctly cached, the "exercising simple_get_filter" test needed to be adjusted to use noop to display the test result value.
Since `instances` now returns full `Puppet::Type` instances, this can be removed. `ResourceShim`s are still used in `to_resource` to work around the various manifest rendering bugs of the base implementation.
f0605ca
to
e379a7a
Compare
Addressed comments and rebased |
No description provided.