puppet-resource_api 1.8.0 → 1.8.1

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: '066920a9f1eca6ad946f2c8f39239482a2d00b756a9ac26db2441c4015a6aa37'
4
- data.tar.gz: b9f87949cc263e98ead6d3fc5dcc480787a8122078e548bb135a2f1c21373f30
3
+ metadata.gz: e1490074420a43833ba41869aa9ccfe401126dd773292d8ab1998d4769c72104
4
+ data.tar.gz: 54c027ce51ab65c46b30522ff1d92a7292a1e3288ab81307c410e1edefbf3d30
5
5
  SHA512:
6
- metadata.gz: c61a6bc59301a6214c53470b213d59493a31056f20b02ab6f6688ee9809f3f0a05494b66e8c2c0daa28fb222af85f132867a4b1164121ac1aa4f184d60a2acda
7
- data.tar.gz: 393f017b70985894eb1f5abe4ecd0ec41d6640bd5d57fa288fb2a66acfc202dcb42b1c11fda89ec1e4c694a688442555015465a8e4ffd6354150da59f245faae
6
+ metadata.gz: e1cabe1b8a956dcfc9e4193ee5d28ef90046972b8b503e647e1a0e96fa99371092fbd13c7d3e4caf2fe78415cbc8e568b2aebc2ae5e7e1b488bc5056227c522c
7
+ data.tar.gz: 6ddb5982af07a32271a4198b29d12c1f25492f6bb45c3f431dfdf548513a4c7be11f552c7c8f8ebc660af8296b437fe60f928629a992103117b920b04387192a
@@ -28,9 +28,9 @@ matrix:
28
28
  bundler: false
29
29
  directories: ~/.rvm
30
30
  before_install: rvm use jruby-9.1.9.0 --install --binary --fuzzy
31
- - rvm: 2.4.3
31
+ - rvm: 2.5.1
32
32
  env: CHECK=rubocop
33
- - rvm: 2.4.3
33
+ - rvm: 2.5.1
34
34
  env: CHECK=license_finder
35
35
  bundler_args: ""
36
36
 
@@ -60,10 +60,18 @@ matrix:
60
60
  env: PUPPET_GEM_VERSION='~> 4.7.0'
61
61
  before_install:
62
62
  - gem install bundler -v '< 2'
63
+ - rvm: 2.5.1
64
+ env: PUPPET_GEM_VERSION='~> 6' # 6.0, soon 6.1
65
+ - rvm: 2.5.1
66
+ env: PUPPET_GEM_VERSION='~> 6.0'
63
67
  - rvm: 2.5.1
64
68
  env: PUPPET_GEM_VERSION='https://github.com/puppetlabs/puppet.git#master'
65
69
  - rvm: 2.5.1
66
70
  env: PUPPET_GEM_VERSION='https://github.com/puppetlabs/puppet.git#6.0.x'
71
+ - rvm: 2.4.3
72
+ env: PUPPET_GEM_VERSION='https://github.com/puppetlabs/puppet.git#5.5.x'
73
+ - rvm: 2.1.9
74
+ env: PUPPET_GEM_VERSION='https://github.com/puppetlabs/puppet.git#4.10.x'
67
75
  notifications:
68
76
  slack:
69
77
  secure: aPXZYNow8LsmmlS8PQU3FjL0bc7FqUUA95d++wZfIu7YAjGboIUiekxYouQ0XnY+Aig8InvbTOIgBHgGNheyr/YFbFS90/jtulbF8oW7BitW+imgjeAHDCwlQZTCc4FFYde/2pI7QTT8H5NpLR9mKxlTU77Sqr8gFAIybuPdHcKMYQZdEZS07ma2pUp7+GyKS6PDQpzW2+mDCz/wfi3/JdsUvc0mclCZ8vxySc66j5P1E6nFDMzuakBOjwJHpgeDpreapbmSUQLAX0a3ZsFP+N+SNduLotlV2BWnJK2gcO6rGFP4Fz1D0bGXuBnYYdIiB+9OgI3wtXg9y1SifNHUG3IrOBAA8CGNyrebTGKtH0TS2O+HZLbaNX2g6udD5e3156vys9wScmJuQ/rSkVtQfXf1qUm5eijvlXI+DIbssbZHqm6QQGyM4p3NoULmNmF1C85bQoZ4GF7b1P/8mstsVE/HUfnzRPNbwD0r6j1aE/ck3PKMi7ZAhIi0Ja9RnAgP3wi0t62uERYcJGGYEycWohMWnrf2w6GFwGeuoiwAkASdHOLX0/AOMPc4mBOjlc621o8uYMrrZqfF5CrOAvJ151USSsWn2AhXaibIvnHo6X91paNvvNpU/GYu3CUAl6q8OhYovvjtRVPVnhs2DrpgoRB+6NWHnzjRG/wr6Z9U+vA=
@@ -3,6 +3,20 @@
3
3
  All significant changes to this repo will be summarized in this file.
4
4
 
5
5
 
6
+ ## [v1.8.1](https://github.com/puppetlabs/puppet-resource_api/tree/v1.8.1) (2019-03-13)
7
+ [Full Changelog](https://github.com/puppetlabs/puppet-resource_api/compare/v1.8.0...v1.8.1)
8
+
9
+ **Fixed bugs:**
10
+
11
+ - \(maint\) Fixes sensitive transport values where absent keys are wrapped [\#161](https://github.com/puppetlabs/puppet-resource_api/pull/161) ([da-ar](https://github.com/da-ar))
12
+
13
+ **Merged pull requests:**
14
+
15
+ - 1.6.x mergeup [\#162](https://github.com/puppetlabs/puppet-resource_api/pull/162) ([DavidS](https://github.com/DavidS))
16
+ - \(FM-7829\) Update README with transports examples [\#160](https://github.com/puppetlabs/puppet-resource_api/pull/160) ([willmeek](https://github.com/willmeek))
17
+ - \(maint\) update release docs [\#159](https://github.com/puppetlabs/puppet-resource_api/pull/159) ([DavidS](https://github.com/DavidS))
18
+ - Improve travis cells and testing [\#145](https://github.com/puppetlabs/puppet-resource_api/pull/145) ([DavidS](https://github.com/DavidS))
19
+
6
20
  ## [v1.8.0](https://github.com/puppetlabs/puppet-resource_api/tree/v1.8.0) (2019-02-26)
7
21
  [Full Changelog](https://github.com/puppetlabs/puppet-resource_api/compare/v1.7.0...v1.8.0)
8
22
 
@@ -22,6 +36,7 @@ All significant changes to this repo will be summarized in this file.
22
36
 
23
37
  **Merged pull requests:**
24
38
 
39
+ - Release prep for v1.8.0 [\#158](https://github.com/puppetlabs/puppet-resource_api/pull/158) ([DavidS](https://github.com/DavidS))
25
40
  - \(FM-7726\) cleanups for the transport [\#153](https://github.com/puppetlabs/puppet-resource_api/pull/153) ([DavidS](https://github.com/DavidS))
26
41
  - \(FM-7691,FM-7696\) refactoring definition handling in contexts [\#150](https://github.com/puppetlabs/puppet-resource_api/pull/150) ([DavidS](https://github.com/DavidS))
27
42
 
data/README.md CHANGED
@@ -172,19 +172,128 @@ The `create`/`update`/`delete` methods get called by the `SimpleProvider` base-c
172
172
 
173
173
  The generated unit tests in `spec/unit/puppet/provider/foo_spec.rb` get automatically evaluated with `pdk test unit`.
174
174
 
175
- ### `puppet device` support
175
+ ## Remote resources
176
176
 
177
- To support remote resources using `puppet device`, a few more steps are needed. First a `Puppet::Util::NetworkDevice::<device type>::Device` class needs to exist, which provides facts and connection management . That device class can inherit from `Puppet::Util::NetworkDevice::Simple::Device` to receive a simple default configuration parser using hocon.
177
+ Support for remote resources is enabled through a `transport` class. A transport class contains the code for managing connections and processing information to and from the remote resource. For information on how to create a transport class, see the [Resource API specification](https://github.com/puppetlabs/puppet-specifications/tree/master/language/resource-api#transport).
178
178
 
179
- The provider needs to specify the `remote_resource` feature to enable the second part of the machinery.
179
+ An example of a transport class:
180
180
 
181
- After this, `puppet device` will be able to use the new provider, and supply it (through the device class) with the URL specified in the [`device.conf`](https://puppet.com/docs/puppet/5.3/config_file_device.html).
181
+ ```ruby
182
+ # lib/puppet/transport/device_type.rb
183
+ module Puppet::Transport
184
+ # The main connection class to a PAN-OS API endpoint
185
+ class DeviceType
186
+ def initialize(context, connection_info)
187
+ # Initialization eg. validate connection_info
188
+ end
189
+
190
+ def verify(context)
191
+ # Test that transport can talk to the remote target
192
+ end
193
+
194
+ def facts(context)
195
+ # Access target, return a Facter facts hash
196
+ end
197
+
198
+ def close(context)
199
+ # Close connection, free up resources
200
+ end
201
+ end
202
+ end
203
+ ```
204
+
205
+ An example of a corresponding schema:
206
+
207
+ ```ruby
208
+ # lib/puppet/transport/device_type.rb
209
+ Puppet::ResourceAPI.register_transport(
210
+ name: 'device_type', # points at class Puppet::Transport::DeviceType
211
+ desc: 'Connects to a device_type',
212
+ # features: [], # future extension points
213
+ connection_info: {
214
+ host: {
215
+ type: 'String',
216
+ desc: 'The host to connect to.',
217
+ },
218
+ user: {
219
+ type: 'String',
220
+ desc: 'The user.',
221
+ },
222
+ password: {
223
+ type: 'String',
224
+ sensitive: true,
225
+ desc: 'The password to connect.',
226
+ },
227
+ enable_password: {
228
+ type: 'String',
229
+ sensitive: true,
230
+ desc: 'The password escalate to enable access.',
231
+ },
232
+ port: {
233
+ type: 'Integer',
234
+ desc: 'The port to connect to.',
235
+ },
236
+ },
237
+ )
238
+ ```
239
+
240
+ ### Transport Schema keywords
241
+
242
+ Please note that within the transport schema, the following keywords are reserved words:
243
+
244
+ #### Usable within the schema
245
+
246
+ The following keywords are encouraged within the Transport schema:
182
247
 
183
- #### Device-specific providers
248
+ * `uri` - Use when you need to specify a specific URL to connect to. All of the following keys will be computed from the `uri` if possible. In the future more url parts may be computed from the URI as well.
249
+ * `host` - Use to specify and IP or address to connect to.
250
+ * `protocol` - Use to specify which protocol the transport should use for example `http`, `https`, `ssh` or `tcp`
251
+ * `user` - The user the transport should connect as.
252
+ * `port` - The port the transport should connect to.
184
253
 
185
- To allow modules to deal with different backends independently of each other, the Resource API also implements a mechanism to use different API providers side-by-side. For a given device type (see above), the Resource API will first try to load a `Puppet::Provider::TypeName::DeviceType` class from `lib/puppet/provider/type_name/device_type.rb`, before falling back to the regular provider at `Puppet::Provider::TypeName::TypeName`.
254
+ #### Non-Usable within the schema
186
255
 
187
- ### Further Reading
256
+ The following keywords are keywords that must not be used by the transport schema:
257
+
258
+ * `name` - transports should use `uri` instead of name.
259
+ * `path` - reserved as a uri part
260
+ * `query` - reserved as a uri part
261
+ * `run-on` - This is used by bolt to determine which target to proxy to. Transports should not rely on this key.
262
+ * `remote-transport` - This is used to determine which transport to load. It should always be the transport class name "declassified".
263
+ * `remote-*` Any key starting with `remote-` is reserved for future use.
264
+
265
+ Note: Currently bolt inventory requires that a name be set for every target and always uses that name as the URI. This means there is no way to specify `host` separately from the host section of the `name` when parsed as a URI.
266
+
267
+ After the device class, transport class and transport schema have been implemented, `puppet device` will be able to use the new provider, and supply it (through the device class) with the URL specified in the [`device.conf`](https://puppet.com/docs/puppet/5.3/config_file_device.html).
268
+
269
+ #### Transport/device specific providers
270
+
271
+ To allow modules to deal with different backends independently, the Resource API implements a mechanism to use different API providers side by side. For a given transport/device class (see above), the Resource API will first try to load a `Puppet::Provider::TypeName::<DeviceType>` class from `lib/puppet/provider/type_name/device_type.rb`, before falling back to the regular provider at `Puppet::Provider::TypeName::TypeName`.
272
+
273
+ ### Puppet backwards compatibility
274
+
275
+ To connect to a remote resource through `puppet device`, you must provide a device shim to maintain compatibility with Puppet. The device shim needs to interface the transport to puppet's config and runtime expectations.
276
+
277
+ In the simplest case you can use the provided `Puppet::ResourceApi::Transport::Wrapper` like this:
278
+
279
+ ```ruby
280
+ # lib/puppet/util/network_device/device_type/device.rb
281
+
282
+ require 'puppet'
283
+ require 'puppet/resource_api/transport/wrapper'
284
+ # force registering the transport schema
285
+ require 'puppet/transport/schema/device_type'
286
+
287
+ module Puppet::Util::NetworkDevice::Device_type
288
+ class Device < Puppet::ResourceApi::Transport::Wrapper
289
+ def initialize(url_or_config, _options = {})
290
+ super('device_type', url_or_config)
291
+ end
292
+ end
293
+ end
294
+ ```
295
+
296
+ ## Further reading
188
297
 
189
298
  The [Resource API](https://github.com/puppetlabs/puppet-specifications/blob/master/language/resource-api/README.md) describes details of all the capabilities of this gem.
190
299
 
@@ -231,19 +340,16 @@ Future possibilities:
231
340
  * [Multiple Providers](https://tickets.puppetlabs.com/browse/PDK-530)
232
341
  * [Commands API](https://tickets.puppetlabs.com/browse/PDK-847)
233
342
 
234
- ## Development
235
-
236
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
237
-
238
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
239
-
240
343
  ## Contributing
241
344
 
242
345
  Bug reports and pull requests are welcome on GitHub at https://github.com/puppetlabs/puppet-resource_api.
243
346
 
244
347
  ### Cutting a release
245
348
 
246
- To cut a new release, from a current `master` checkout:
349
+ In some cases we need to manually cut a release outside of the regular puppet
350
+ agent process.
351
+
352
+ To do so, follow these instructions from a current `master` checkout:
247
353
 
248
354
  * Start the release branch with `git checkout -b release-prep`
249
355
  * Update `lib/puppet/resource_api/version.rb` to the new version
@@ -84,7 +84,7 @@ module Puppet::ResourceApi::Transport
84
84
  transport_schema = @transports[@environment][name]
85
85
  if transport_schema
86
86
  transport_schema.definition[:connection_info].each do |attr_name, options|
87
- if options.key?(:sensitive) && (options[:sensitive] == true)
87
+ if options.key?(:sensitive) && (options[:sensitive] == true) && connection_info.key?(attr_name)
88
88
  connection_info[attr_name] = Puppet::Pops::Types::PSensitiveType::Sensitive.new(connection_info[attr_name])
89
89
  end
90
90
  end
@@ -1,5 +1,5 @@
1
1
  module Puppet
2
2
  module ResourceApi
3
- VERSION = '1.8.0'.freeze
3
+ VERSION = '1.8.1'.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.8.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Schmitt
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-26 00:00:00.000000000 Z
11
+ date: 2019-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hocon