puppet-resource_api 1.4.1 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d29f5e5eebf841dba323c731c6a6a423fc904b7cc52a000a708307ff5bbe51cc
4
- data.tar.gz: 01e210072f6c0154c3964a93e45ebd8388469c25a0e47b5d4ab547e9f9321733
3
+ metadata.gz: 105c2d9cb6636fc3d70e1250bf84e4a56392199aadbfcb3be58471282f9f9c36
4
+ data.tar.gz: 1ce5d86677e93beb2375fd83c7e1eb95b4b3132cf001b6cf2534135244c53e84
5
5
  SHA512:
6
- metadata.gz: c91d23aa2991cbadf1714930bb5a02e5366f1d8308350f9be96d4c76eef12a5b462776f6d068dd80762b5f11b667a734d7dc04593d5fd38b294c36bae6e0f8f3
7
- data.tar.gz: c9ba9579b7057a34c5056db7d4bf89ecceafb7e4eab8c3fe62dfdafe190eb353d72e28e680a7d91b472351b14bccf563b744aff5c2f6a0ed9773abee7e24f42c
6
+ metadata.gz: 057617a9cdde0351dcee064dfaba1cd439c60dd6112feea96b5045febb80248ce9bcc96fb9d0ba893021efafc275f5ded07e29ed6ff61f9d4df7965f4586e378
7
+ data.tar.gz: 4640b315d89e61001df0e41f304547c686e1317e4428dd102a9232bf46c930f2eb5b3f3508880372d70474e8235f014e363d0a9928bdaf28af01a343927081dc
data/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All significant changes to this repo will be summarized in this file.
4
4
 
5
5
 
6
+ ## [v1.4.2](https://github.com/puppetlabs/puppet-resource_api/tree/v1.4.2) (2018-08-09)
7
+ [Full Changelog](https://github.com/puppetlabs/puppet-resource_api/compare/v1.4.1...v1.4.2)
8
+
9
+ **Fixed bugs:**
10
+
11
+ - Allow an attribute with default boolean value to be set correctly [\#110](https://github.com/puppetlabs/puppet-resource_api/pull/110) ([da-ar](https://github.com/da-ar))
12
+
13
+ **Merged pull requests:**
14
+
15
+ - \(maint\) fix brace alignment; document reference [\#111](https://github.com/puppetlabs/puppet-resource_api/pull/111) ([DavidS](https://github.com/DavidS))
16
+ - Release prep for v1.4.1 [\#109](https://github.com/puppetlabs/puppet-resource_api/pull/109) ([DavidS](https://github.com/DavidS))
17
+
6
18
  ## [v1.4.1](https://github.com/puppetlabs/puppet-resource_api/tree/v1.4.1) (2018-07-20)
7
19
  [Full Changelog](https://github.com/puppetlabs/puppet-resource_api/compare/v1.4.0...v1.4.1)
8
20
 
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  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.
4
4
 
5
- ## Install the Resource API
5
+ ## Getting Started
6
6
 
7
7
  1. Download the [Puppet Development Kit](https://puppet.com/download-puppet-development-kit) (PDK) appropriate to your operating system and architecture.
8
8
 
@@ -47,7 +47,7 @@ $
47
47
  ```
48
48
 
49
49
  5. Create the required files for a new type and provider in the module by running `pdk new provider <provider_name>`
50
-
50
+
51
51
  You will get the following response:
52
52
 
53
53
  ```
@@ -82,13 +82,13 @@ Puppet::ResourceApi.register_type(
82
82
  docs: <<-EOS,
83
83
  This type provides Puppet with the capabilities to manage ...
84
84
  EOS
85
- attributes: {
86
- ensure: {
85
+ attributes: {
86
+ ensure: {
87
87
  type: 'Enum[present, absent]',
88
88
  desc: 'Whether this apt key should be present or absent on the target system.',
89
89
  default: 'present',
90
90
  },
91
- name: {
91
+ name: {
92
92
  type: 'String',
93
93
  desc: 'The name of the resource you want to manage.',
94
94
  behaviour: :namevar,
@@ -179,9 +179,18 @@ module Puppet::ResourceApi
179
179
  end
180
180
 
181
181
  # read-only values do not need type checking, but can have default values
182
- if options[:behaviour] != :read_only
182
+ if options[:behaviour] != :read_only && options.key?(:default)
183
183
  if options.key? :default
184
- defaultto options[:default]
184
+ if options[:default] == false
185
+ # work around https://tickets.puppetlabs.com/browse/PUP-2368
186
+ defaultto :false # rubocop:disable Lint/BooleanSymbol
187
+ elsif options[:default] == true
188
+ # work around https://tickets.puppetlabs.com/browse/PUP-2368
189
+ defaultto :true # rubocop:disable Lint/BooleanSymbol
190
+ else
191
+ defaultto options[:default]
192
+ end
193
+ # defaultto options[:default]
185
194
  end
186
195
  end
187
196
 
@@ -195,11 +204,14 @@ module Puppet::ResourceApi
195
204
 
196
205
  if param_or_property == :newproperty
197
206
  define_method(:should) do
198
- if type.is_a? Puppet::Pops::Types::PBooleanType
199
- # work around https://tickets.puppetlabs.com/browse/PUP-2368
200
- rs_value ? :true : :false # rubocop:disable Lint/BooleanSymbol
201
- elsif name == :ensure && rs_value.is_a?(String)
207
+ if name == :ensure && rs_value.is_a?(String)
202
208
  rs_value.to_sym
209
+ elsif rs_value == false
210
+ # work around https://tickets.puppetlabs.com/browse/PUP-2368
211
+ :false # rubocop:disable Lint/BooleanSymbol
212
+ elsif rs_value == true
213
+ # work around https://tickets.puppetlabs.com/browse/PUP-2368
214
+ :true # rubocop:disable Lint/BooleanSymbol
203
215
  else
204
216
  rs_value
205
217
  end
@@ -521,6 +533,12 @@ MESSAGE
521
533
  # the correct types, e.g. "1" (a string) to 1 (an integer)
522
534
  cleaned_value, error_msg = try_mungify(type, value, error_msg_prefix)
523
535
  raise Puppet::ResourceError, error_msg if error_msg
536
+ elsif value == :false # rubocop:disable Lint/BooleanSymbol
537
+ # work around https://tickets.puppetlabs.com/browse/PUP-2368
538
+ cleaned_value = false
539
+ elsif value == :true # rubocop:disable Lint/BooleanSymbol
540
+ # work around https://tickets.puppetlabs.com/browse/PUP-2368
541
+ cleaned_value = true
524
542
  else
525
543
  # Every other time, we can use the values as is
526
544
  cleaned_value = value
@@ -1,5 +1,5 @@
1
1
  module Puppet
2
2
  module ResourceApi
3
- VERSION = '1.4.1'.freeze
3
+ VERSION = '1.4.2'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-resource_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Schmitt
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-20 00:00:00.000000000 Z
11
+ date: 2018-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hocon