puppet-resource_api 1.8.7 → 1.8.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -3
- data/README.md +8 -366
- data/lib/puppet/resource_api/version.rb +1 -1
- metadata +2 -3
- data/misc/ANNOUNCEMENT_TEMPLATE.md +0 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d14e2bf3972db6032efa89ba6051d141c97f0e68a8977f6f667650051a06bdf4
|
4
|
+
data.tar.gz: 4a1609c8cf63542580ad8145ccaa971991b354266496b8f1067a91bf141b66af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88e11a56b4494310be4e5912f9e48f0cb845bcc693f8e16888704db464e3e989c051afe2aece82ec393b3b1237eed002606a8c1600f396b42a54294669e14447
|
7
|
+
data.tar.gz: cf6597f4ef293e46ae1791b693a344dc7e7624cec153a86983c6199db311280a706a5b3efae2aa30739e2631e107ff44d3ba493ca6226f24246ae1e1f7a086b8
|
data/CHANGELOG.md
CHANGED
@@ -3,8 +3,24 @@
|
|
3
3
|
All significant changes to this repo will be summarized in this file.
|
4
4
|
|
5
5
|
|
6
|
-
## [
|
7
|
-
[Full Changelog](https://github.com/puppetlabs/puppet-resource_api/compare/1.8.
|
6
|
+
## [1.8.7](https://github.com/puppetlabs/puppet-resource_api/tree/1.8.7) (2019-09-11)
|
7
|
+
[Full Changelog](https://github.com/puppetlabs/puppet-resource_api/compare/1.8.6...1.8.7)
|
8
|
+
|
9
|
+
**Fixed bugs:**
|
10
|
+
|
11
|
+
- \(FM-8092\) Fix caching scope of transport schemas [\#200](https://github.com/puppetlabs/puppet-resource_api/pull/200) ([DavidS](https://github.com/DavidS))
|
12
|
+
|
13
|
+
**Merged pull requests:**
|
14
|
+
|
15
|
+
- \(FM-8485\) - Addition of CODEOWNERS file [\#203](https://github.com/puppetlabs/puppet-resource_api/pull/203) ([david22swan](https://github.com/david22swan))
|
16
|
+
- \(MODULES-9258\) Improve referencing and add summary [\#199](https://github.com/puppetlabs/puppet-resource_api/pull/199) ([MaxMagill](https://github.com/MaxMagill))
|
17
|
+
- \(maint\) Pin both Jruby cells to use `dist: trusty` [\#197](https://github.com/puppetlabs/puppet-resource_api/pull/197) ([da-ar](https://github.com/da-ar))
|
18
|
+
|
19
|
+
## [1.8.6](https://github.com/puppetlabs/puppet-resource_api/tree/1.8.6) (2019-07-04)
|
20
|
+
[Full Changelog](https://github.com/puppetlabs/puppet-resource_api/compare/1.6.5...1.8.6)
|
21
|
+
|
22
|
+
## [1.6.5](https://github.com/puppetlabs/puppet-resource_api/tree/1.6.5) (2019-07-04)
|
23
|
+
[Full Changelog](https://github.com/puppetlabs/puppet-resource_api/compare/1.8.5...1.6.5)
|
8
24
|
|
9
25
|
**Implemented enhancements:**
|
10
26
|
|
@@ -16,10 +32,12 @@ All significant changes to this repo will be summarized in this file.
|
|
16
32
|
|
17
33
|
**Merged pull requests:**
|
18
34
|
|
35
|
+
- \(packaging\) Bump to 1.6.5 [\#196](https://github.com/puppetlabs/puppet-resource_api/pull/196) ([gimmyxd](https://github.com/gimmyxd))
|
19
36
|
- Merge 1.6.x [\#194](https://github.com/puppetlabs/puppet-resource_api/pull/194) ([da-ar](https://github.com/da-ar))
|
20
37
|
- \(maint\) test fixes [\#193](https://github.com/puppetlabs/puppet-resource_api/pull/193) ([DavidS](https://github.com/DavidS))
|
21
38
|
- \(packaging\) Revert to version '1.8.5' \[no-promote\] [\#192](https://github.com/puppetlabs/puppet-resource_api/pull/192) ([gimmyxd](https://github.com/gimmyxd))
|
22
39
|
- \(packaging\) Bump to version '1.9.0' \[no-promote\] [\#191](https://github.com/puppetlabs/puppet-resource_api/pull/191) ([gimmyxd](https://github.com/gimmyxd))
|
40
|
+
- \(maint\) retrofitting changelog for the last couple of releases [\#190](https://github.com/puppetlabs/puppet-resource_api/pull/190) ([DavidS](https://github.com/DavidS))
|
23
41
|
|
24
42
|
## [1.8.5](https://github.com/puppetlabs/puppet-resource_api/tree/1.8.5) (2019-06-24)
|
25
43
|
[Full Changelog](https://github.com/puppetlabs/puppet-resource_api/compare/1.8.4...1.8.5)
|
@@ -34,7 +52,6 @@ All significant changes to this repo will be summarized in this file.
|
|
34
52
|
- \(FM-8265\) Merge branch '1.6.x' into master [\#188](https://github.com/puppetlabs/puppet-resource_api/pull/188) ([da-ar](https://github.com/da-ar))
|
35
53
|
- \(maint\) test fixes [\#185](https://github.com/puppetlabs/puppet-resource_api/pull/185) ([DavidS](https://github.com/DavidS))
|
36
54
|
- \(maint\) make test order really random [\#175](https://github.com/puppetlabs/puppet-resource_api/pull/175) ([DavidS](https://github.com/DavidS))
|
37
|
-
- \(packaging\) Update reported version to 1.8.4 \[no-promote\] [\#171](https://github.com/puppetlabs/puppet-resource_api/pull/171) ([gimmyxd](https://github.com/gimmyxd))
|
38
55
|
|
39
56
|
## [1.8.4](https://github.com/puppetlabs/puppet-resource_api/tree/1.8.4) (2019-06-12)
|
40
57
|
[Full Changelog](https://github.com/puppetlabs/puppet-resource_api/compare/1.8.3...1.8.4)
|
@@ -59,6 +76,7 @@ All significant changes to this repo will be summarized in this file.
|
|
59
76
|
- \(maint\) Merge 1.6.x to master [\#183](https://github.com/puppetlabs/puppet-resource_api/pull/183) ([mihaibuzgau](https://github.com/mihaibuzgau))
|
60
77
|
- \(maint\) Fixup Gemfile for JRuby 1.7 installs [\#173](https://github.com/puppetlabs/puppet-resource_api/pull/173) ([da-ar](https://github.com/da-ar))
|
61
78
|
- \(maint\) test cleanups [\#172](https://github.com/puppetlabs/puppet-resource_api/pull/172) ([DavidS](https://github.com/DavidS))
|
79
|
+
- \(packaging\) Update reported version to 1.8.4 \[no-promote\] [\#171](https://github.com/puppetlabs/puppet-resource_api/pull/171) ([gimmyxd](https://github.com/gimmyxd))
|
62
80
|
|
63
81
|
## [1.8.3](https://github.com/puppetlabs/puppet-resource_api/tree/1.8.3) (2019-04-12)
|
64
82
|
[Full Changelog](https://github.com/puppetlabs/puppet-resource_api/compare/1.8.2...1.8.3)
|
@@ -81,11 +99,16 @@ All significant changes to this repo will be summarized in this file.
|
|
81
99
|
## [v1.6.4](https://github.com/puppetlabs/puppet-resource_api/tree/v1.6.4) (2019-03-25)
|
82
100
|
[Full Changelog](https://github.com/puppetlabs/puppet-resource_api/compare/v1.8.1...v1.6.4)
|
83
101
|
|
102
|
+
**Implemented enhancements:**
|
103
|
+
|
104
|
+
- \(PDK-1271\) Allow a transport to be wrapped and used like a device [\#155](https://github.com/puppetlabs/puppet-resource_api/pull/155) ([da-ar](https://github.com/da-ar))
|
105
|
+
|
84
106
|
**Merged pull requests:**
|
85
107
|
|
86
108
|
- Add `implementations` to reserved bolt keywords [\#165](https://github.com/puppetlabs/puppet-resource_api/pull/165) ([DavidS](https://github.com/DavidS))
|
87
109
|
- \(MAINT\) Bump version [\#164](https://github.com/puppetlabs/puppet-resource_api/pull/164) ([sebastian-miclea](https://github.com/sebastian-miclea))
|
88
110
|
- Release prep for v1.8.1 [\#163](https://github.com/puppetlabs/puppet-resource_api/pull/163) ([DavidS](https://github.com/DavidS))
|
111
|
+
- 1.6.x mergeup [\#162](https://github.com/puppetlabs/puppet-resource_api/pull/162) ([DavidS](https://github.com/DavidS))
|
89
112
|
|
90
113
|
# Changelog
|
91
114
|
|
data/README.md
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
# 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)
|
2
2
|
|
3
|
-
This is an implementation of the [Resource API](https://github.com/puppetlabs/puppet-specifications/blob/master/language/resource-api/README.md)
|
3
|
+
This is an implementation of the [Resource API specification](https://github.com/puppetlabs/puppet-specifications/blob/master/language/resource-api/README.md).
|
4
|
+
|
5
|
+
Find a working example of a new-style providers in the [Palo Alto Firewall module](https://github.com/puppetlabs/puppetlabs-panos/):
|
6
|
+
* [Type](https://github.com/puppetlabs/puppetlabs-panos/blob/master/lib/puppet/type/panos_address.rb)
|
4
7
|
* [Base provider](https://github.com/puppetlabs/puppetlabs-panos/blob/master/lib/puppet/provider/panos_provider.rb)
|
5
|
-
* [
|
6
|
-
* [Actual provider with validation and xml processing](https://github.com/puppetlabs/puppetlabs-panos/blob/master/lib/puppet/provider/panos_address/panos_address.rb)
|
8
|
+
* [Actual provider with validation and xml processing](https://github.com/puppetlabs/puppetlabs-panos/blob/master/lib/puppet/provider/panos_address/panos_address.rb)
|
7
9
|
* [New unit tests](https://github.com/puppetlabs/puppetlabs-panos/blob/master/spec/unit/puppet/provider/panos_provider_spec.rb) for 100% coverage.
|
8
10
|
|
9
|
-
## [Find the full Resource API documentation here](https://
|
11
|
+
## [Find the full Resource API documentation here](https://puppet.com/docs/puppet/latest/custom_resources.html)
|
10
12
|
|
11
13
|
## Related Documents
|
12
14
|
|
@@ -18,356 +20,18 @@ This is an implementation of the [Resource API](https://github.com/puppetlabs/pu
|
|
18
20
|
* Read [betterspecs](http://www.betterspecs.org/) for general guidelines on what is considered good specs.
|
19
21
|
|
20
22
|
|
21
|
-
|
22
23
|
## Deployment
|
23
24
|
|
24
25
|
The `puppet-resource_api` gem is part of the [Puppet 6 Platform](https://puppet.com/blog/introducing-puppet-6). With older versions of Puppet, you can use the [puppetlabs-resource_api module](https://forge.puppet.com/puppetlabs/resource_api) to install the gem on your servers and agents.
|
25
26
|
|
26
|
-
## Getting Started
|
27
|
-
|
28
|
-
1. Download the [Puppet Development Kit](https://puppet.com/download-puppet-development-kit) (PDK) appropriate to your operating system and architecture.
|
29
|
-
|
30
|
-
2. Create a [new module](https://puppet.com/docs/pdk/latest/pdk_generating_modules.html) with the PDK, or work with an existing PDK-enabled module. To create a new module, run `pdk new module <MODULE_NAME>` from the command line, specifying the name of the module. Respond to the dialog questions.
|
31
|
-
|
32
|
-
3. To add the `puppet-resource_api` gem and enable "modern" rspec-style mocking, open the `.sync.yml` file in your editor, and add the following content:
|
33
|
-
|
34
|
-
```
|
35
|
-
# .sync.yml
|
36
|
-
---
|
37
|
-
Gemfile:
|
38
|
-
optional:
|
39
|
-
':development':
|
40
|
-
- gem: 'puppet-resource_api'
|
41
|
-
spec/spec_helper.rb:
|
42
|
-
mock_with: ':rspec'
|
43
|
-
```
|
44
|
-
|
45
|
-
4. Apply these changes by running `pdk update`
|
46
|
-
|
47
|
-
You will get the following response:
|
48
|
-
|
49
|
-
```
|
50
|
-
$ pdk update
|
51
|
-
pdk (INFO): Updating david-example using the default template, from 1.4.1 to 1.4.1
|
52
|
-
|
53
|
-
----------Files to be modified----------
|
54
|
-
Gemfile
|
55
|
-
spec/spec_helper.rb
|
56
|
-
|
57
|
-
----------------------------------------
|
58
|
-
|
59
|
-
You can find a report of differences in update_report.txt.
|
60
|
-
|
61
|
-
Do you want to continue and make these changes to your module? Yes
|
62
|
-
|
63
|
-
------------Update completed------------
|
64
|
-
|
65
|
-
2 files modified.
|
66
|
-
|
67
|
-
$
|
68
|
-
```
|
69
|
-
|
70
|
-
5. Create the required files for a new type and provider in the module by running `pdk new provider <provider_name>`
|
71
|
-
|
72
|
-
You will get the following response:
|
73
|
-
|
74
|
-
```
|
75
|
-
$ pdk new provider foo
|
76
|
-
pdk (INFO): Creating '.../example/lib/puppet/type/foo.rb' from template.
|
77
|
-
pdk (INFO): Creating '.../example/lib/puppet/provider/foo/foo.rb' from template.
|
78
|
-
pdk (INFO): Creating '.../example/spec/unit/puppet/provider/foo/foo_spec.rb' from template.
|
79
|
-
pdk (INFO): Creating '.../example/spec/unit/puppet/type/foo_spec.rb' from template.
|
80
|
-
$
|
81
|
-
```
|
82
|
-
|
83
|
-
The four generated files are the type, the implementation, and the unit tests. The default template contains an example that demonstrates the basic workings of the Resource API. This allows the unit tests to run immediately after creating the provider, which will look like this:
|
84
|
-
|
85
|
-
```
|
86
|
-
$ pdk test unit
|
87
|
-
[✔] Preparing to run the unit tests.
|
88
|
-
[✔] Running unit tests.
|
89
|
-
Evaluated 5 tests in 0.012065973 seconds: 0 failures, 0 pending.
|
90
|
-
[✔] Cleaning up after running unit tests.
|
91
|
-
$
|
92
|
-
```
|
93
|
-
|
94
|
-
### Writing the Type
|
95
|
-
|
96
|
-
The type contains the shape of your resources. The template provides the necessary `name` and `ensure` attributes. You can modify their description and the name's type to match your resource. Add more attributes as you need.
|
97
|
-
|
98
|
-
```ruby
|
99
|
-
# lib/puppet/type/foo.rb
|
100
|
-
require 'puppet/resource_api'
|
101
|
-
|
102
|
-
Puppet::ResourceApi.register_type(
|
103
|
-
name: 'foo',
|
104
|
-
docs: <<-EOS,
|
105
|
-
This type provides Puppet with the capabilities to manage ...
|
106
|
-
EOS
|
107
|
-
attributes: {
|
108
|
-
ensure: {
|
109
|
-
type: 'Enum[present, absent]',
|
110
|
-
desc: 'Whether this apt key should be present or absent on the target system.',
|
111
|
-
default: 'present',
|
112
|
-
},
|
113
|
-
name: {
|
114
|
-
type: 'String',
|
115
|
-
desc: 'The name of the resource you want to manage.',
|
116
|
-
behaviour: :namevar,
|
117
|
-
},
|
118
|
-
},
|
119
|
-
)
|
120
|
-
```
|
121
|
-
|
122
|
-
The following keys are available for defining attributes:
|
123
|
-
* `type`: the Puppet 4 data type allowed in this attribute. You can use all [data types](https://puppet.com/docs/puppet/latest/lang_data_abstract.html#parent-types) matching `Scalar` and `Data`.
|
124
|
-
* `desc`: a string describing this attribute. This is used in creating the automated API docs with [puppet-strings](https://github.com/puppetlabs/puppet-strings).
|
125
|
-
* `default`: a default value used by the runtime environment; when the caller does not specify a value for this attribute.
|
126
|
-
* `behaviour`/`behavior`: how the attribute behaves. The current available values include:
|
127
|
-
* `namevar`: marks an attribute as part of the "primary key" or "identity" of the resource. A given set of `namevar` values needs to distinctively identify an instance.
|
128
|
-
* `init_only`: this attribute can only be set during the creation of the resource. Its value will be reported going forward, but trying to change it later leads to an error. For example, the base image for a VM or the UID of a user.
|
129
|
-
* `read_only`: values for this attribute will be returned by `get()`, but `set()` is not able to change them. Values for this should never be specified in a manifest. For example, the checksum of a file, or the MAC address of a network interface.
|
130
|
-
* `parameter`: these attributes influence how the provider behaves, and cannot be read from the target system. For example, the target file on inifile, or the credentials to access an API.
|
131
|
-
|
132
|
-
Further information about types can be found in The [Resource API](https://github.com/puppetlabs/puppet-specifications/blob/master/language/resource-api/README.md#resource-definition-type)
|
133
|
-
|
134
|
-
### Writing the Provider
|
135
|
-
|
136
|
-
The provider is the most important part of your new resource, as it reads and enforces state. Here is the example generated by `pdk new provider`:
|
137
|
-
|
138
|
-
```ruby
|
139
|
-
require 'puppet/resource_api'
|
140
|
-
require 'puppet/resource_api/simple_provider'
|
141
|
-
|
142
|
-
# Implementation for the foo type using the Resource API.
|
143
|
-
class Puppet::Provider::Foo::Foo < Puppet::ResourceApi::SimpleProvider
|
144
|
-
def get(_context)
|
145
|
-
[
|
146
|
-
{
|
147
|
-
name: 'foo',
|
148
|
-
ensure: 'present',
|
149
|
-
},
|
150
|
-
{
|
151
|
-
name: 'bar',
|
152
|
-
ensure: 'present',
|
153
|
-
},
|
154
|
-
]
|
155
|
-
end
|
156
|
-
|
157
|
-
def create(context, name, should)
|
158
|
-
context.notice("Creating '#{name}' with #{should.inspect}")
|
159
|
-
end
|
160
|
-
|
161
|
-
def update(context, name, should)
|
162
|
-
context.notice("Updating '#{name}' with #{should.inspect}")
|
163
|
-
end
|
164
|
-
|
165
|
-
def delete(context, name)
|
166
|
-
context.notice("Deleting '#{name}'")
|
167
|
-
end
|
168
|
-
end
|
169
|
-
```
|
170
|
-
|
171
|
-
The optional `initialize` method can be used to set up state that is available throughout the execution of the catalog. This is most often used for establishing a connection, when talking to a service (e.g. when managing a database).
|
172
|
-
|
173
|
-
The `get(context)` method returns a list of hashes describing the resources that are currently on the target system. The basic example would always return an empty list. Here is an example of resources that could be returned from this:
|
174
|
-
|
175
|
-
```ruby
|
176
|
-
[
|
177
|
-
{
|
178
|
-
name: 'a',
|
179
|
-
ensure: 'present',
|
180
|
-
},
|
181
|
-
{
|
182
|
-
name: 'b',
|
183
|
-
ensure: 'present',
|
184
|
-
},
|
185
|
-
]
|
186
|
-
```
|
187
|
-
|
188
|
-
The `create`/`update`/`delete` methods get called by the `SimpleProvider` base-class to change the system as requested by the catalog. The `name` argument is the name of the resource that is being processed. `should` contains the attribute hash - in the same format as `get` returns - with the values in the catalog.
|
189
|
-
|
190
|
-
Further reading can be found in the Resource API:
|
191
|
-
* [Resource Implementation](https://github.com/puppetlabs/puppet-specifications/blob/master/language/resource-api/README.md#resource-implementation-provider)
|
192
|
-
* [Implmentation of simple providers](https://github.com/puppetlabs/puppet-specifications/blob/master/language/resource-api/README.md#implementing-simple-providers)
|
193
|
-
* [Provider Features](https://github.com/puppetlabs/puppet-specifications/blob/master/language/resource-api/README.md#provider-features)
|
194
|
-
|
195
|
-
### Unit testing
|
196
|
-
|
197
|
-
The generated unit tests in `spec/unit/puppet/provider/foo_spec.rb` get automatically evaluated with `pdk test unit`.
|
198
|
-
|
199
|
-
## Remote resources
|
200
|
-
|
201
|
-
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).
|
202
|
-
|
203
|
-
An example of a transport class:
|
204
|
-
|
205
|
-
```ruby
|
206
|
-
# lib/puppet/transport/device_type.rb
|
207
|
-
module Puppet::Transport
|
208
|
-
# The main connection class to a PAN-OS API endpoint
|
209
|
-
class DeviceType
|
210
|
-
def initialize(context, connection_info)
|
211
|
-
# Initialization eg. validate connection_info
|
212
|
-
end
|
213
|
-
|
214
|
-
def verify(context)
|
215
|
-
# Test that transport can talk to the remote target
|
216
|
-
end
|
217
|
-
|
218
|
-
def facts(context)
|
219
|
-
# Access target, return a Facter facts hash
|
220
|
-
end
|
221
|
-
|
222
|
-
def close(context)
|
223
|
-
# Close connection, free up resources
|
224
|
-
end
|
225
|
-
end
|
226
|
-
end
|
227
|
-
```
|
228
|
-
|
229
|
-
An example of a corresponding schema:
|
230
|
-
|
231
|
-
```ruby
|
232
|
-
# lib/puppet/transport/device_type.rb
|
233
|
-
Puppet::ResourceAPI.register_transport(
|
234
|
-
name: 'device_type', # points at class Puppet::Transport::DeviceType
|
235
|
-
desc: 'Connects to a device_type',
|
236
|
-
# features: [], # future extension points
|
237
|
-
connection_info: {
|
238
|
-
host: {
|
239
|
-
type: 'String',
|
240
|
-
desc: 'The host to connect to.',
|
241
|
-
},
|
242
|
-
user: {
|
243
|
-
type: 'String',
|
244
|
-
desc: 'The user.',
|
245
|
-
},
|
246
|
-
password: {
|
247
|
-
type: 'String',
|
248
|
-
sensitive: true,
|
249
|
-
desc: 'The password to connect.',
|
250
|
-
},
|
251
|
-
enable_password: {
|
252
|
-
type: 'String',
|
253
|
-
sensitive: true,
|
254
|
-
desc: 'The password escalate to enable access.',
|
255
|
-
},
|
256
|
-
port: {
|
257
|
-
type: 'Integer',
|
258
|
-
desc: 'The port to connect to.',
|
259
|
-
},
|
260
|
-
},
|
261
|
-
)
|
262
|
-
```
|
263
|
-
|
264
|
-
### Transport Schema keywords
|
265
|
-
|
266
|
-
To align with [Bolt's inventory file](https://puppet.com/docs/bolt/latest/inventory_file.html), a transport schema prefers the following keywords (when relevant):
|
267
|
-
|
268
|
-
* `uri`: use when you need to specify a specific URL to connect to. Bolt will compute the following keys from the `uri` when possible. In the future more url parts may be computed from the URI.
|
269
|
-
* `protocol`: use to specify which protocol the transport should use for example `http`, `https`, `ssh` or `tcp`.
|
270
|
-
* `host`: use to specify an IP or address to connect to.
|
271
|
-
* `port`: the port the transport should connect to.
|
272
|
-
* `user`: the user the transport should connect as.
|
273
|
-
* `password`: the password for the specified user.
|
274
|
-
|
275
|
-
Do not use the following keywords when writing a schema:
|
276
|
-
|
277
|
-
* `implementations`: reserved by Bolt.
|
278
|
-
* `name`: transports should use `uri` instead of name.
|
279
|
-
* `path`: reserved as a uri part.
|
280
|
-
* `query`: reserved as a uri part.
|
281
|
-
* `remote-*`: any key starting with `remote-` is reserved for future use.
|
282
|
-
* `remote-transport`: determines which transport to load. It is always the transport class named "declassified".
|
283
|
-
* `run-on`: Bolt uses this keyword to determine which target to proxy to. Transports should not rely on this key.
|
284
|
-
|
285
|
-
> Note: Bolt inventory requires you to set a name for every target and always use it for the URI. This means that there is no way to specify `host` separately from the host section of the `name` when parsed as a URI.
|
286
|
-
|
287
|
-
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).
|
288
|
-
|
289
|
-
* Further reading can be found in The [Resource API](https://github.com/puppetlabs/puppet-specifications/blob/master/language/resource-api/README.md#transports).
|
290
|
-
|
291
|
-
### Puppet backwards compatibility
|
292
|
-
|
293
|
-
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.
|
294
|
-
|
295
|
-
In the simplest case you can use the provided `Puppet::ResourceApi::Transport::Wrapper` like this:
|
296
|
-
|
297
|
-
```ruby
|
298
|
-
# lib/puppet/util/network_device/device_type/device.rb
|
299
|
-
|
300
|
-
require 'puppet'
|
301
|
-
require 'puppet/resource_api/transport/wrapper'
|
302
|
-
# force registering the transport schema
|
303
|
-
require 'puppet/transport/schema/device_type'
|
304
|
-
|
305
|
-
module Puppet::Util::NetworkDevice::Device_type
|
306
|
-
class Device < Puppet::ResourceApi::Transport::Wrapper
|
307
|
-
def initialize(url_or_config, _options = {})
|
308
|
-
super('device_type', url_or_config)
|
309
|
-
end
|
310
|
-
end
|
311
|
-
end
|
312
|
-
```
|
313
|
-
|
314
|
-
## Summary
|
315
|
-
|
316
|
-
### Getting Started
|
317
|
-
1. Download the [Puppet Development Kit](https://puppet.com/download-puppet-development-kit).
|
318
|
-
2. Create a [new module](https://puppet.com/docs/pdk/latest/pdk_generating_modules.html) by running `pdk new module <MODULE_NAME>`.
|
319
|
-
3. Open `.sync.yml` and add the follwing code to to add the `puppet-resource-api` gem:
|
320
|
-
```
|
321
|
-
# .sync.yml
|
322
|
-
---
|
323
|
-
Gemfile:
|
324
|
-
optional:
|
325
|
-
':development':
|
326
|
-
- gem: 'puppet-resource_api'
|
327
|
-
spec/spec_helper.rb:
|
328
|
-
mock_with: ':rspec'
|
329
|
-
```
|
330
|
-
4. Run `pdk update` to apply the changes.
|
331
|
-
5. Run `pdk new provider <provider_name>` to create the type and provider files.
|
332
|
-
|
333
|
-
### The Type, Provider and Transport
|
334
|
-
The type is a template for the nessesary resources such as `name` and `ensure`. More attributes can be added, as well as modified to match our resources.
|
335
|
-
|
336
|
-
The provider reads and enforces the state. An `initialize` method can be used for establising connection. `get(context)` can be used to et a hash list of resources on the target system.
|
337
|
-
The `create`/`update`/`delete` methods get called by the `SimpleProvider` base-class to change the system as requested by the catalog.
|
338
|
-
`should`contins the attriute hash with the values in the catalog.
|
339
|
-
See full description above for examples.
|
340
|
-
|
341
|
-
Remote resource support is enable thourhg the `transport` class, which manages connections and information to and form remote resources. See above for an example transport class and a fll list of keywords for the transport class.
|
342
|
-
|
343
|
-
For more detailed explainations, refer to the content above, or the [Resource API](https://github.com/puppetlabs/puppet-specifications/blob/master/language/resource-api/README.md) specification.
|
344
27
|
|
345
28
|
## Contributing
|
346
|
-
We are always welcoming bug reports and pull requests on the Resource API, so that we can continue to improve it to the best of our ability. If you would like to contribute, [have a look at our GitHub](https://github.com/puppetlabs/puppet-resource_api).
|
29
|
+
We are always welcoming bug reports and pull requests on the Resource API, so that we can continue to improve it to the best of our ability. If you would like to contribute, [have a look at our GitHub](https://github.com/puppetlabs/puppet-resource_api) and the [Resource API Backlog](https://github.com/puppetlabs/puppet-resource_api/projects/1).
|
347
30
|
|
348
|
-
## Known Issues
|
349
31
|
|
350
|
-
|
351
|
-
|
352
|
-
Currently working:
|
353
|
-
* Basic type and provider definition, using `name`, `desc`, and `attributes`.
|
354
|
-
* Scalar puppet 4 [data types](https://puppet.com/docs/puppet/5.3/lang_data_type.html#core-data-types):
|
355
|
-
* String, Enum, Pattern
|
356
|
-
* Integer, Float, Numeric
|
357
|
-
* Boolean
|
358
|
-
* Array
|
359
|
-
* Optional
|
360
|
-
* Variant
|
361
|
-
* The `canonicalize`, `simple_get_filter`, and `remote_resource` features.
|
362
|
-
* All the logging facilities.
|
363
|
-
* Executing the new provider under the following commands:
|
364
|
-
* `puppet apply`
|
365
|
-
* `puppet resource`
|
366
|
-
* `puppet agent`
|
367
|
-
* `puppet device` (if applicable)
|
32
|
+
## Known Issues
|
368
33
|
|
369
34
|
There are still a few notable gaps between the implementation and the specification:
|
370
|
-
* Complex data types, like Hash, Tuple or Struct are not yet implemented.
|
371
35
|
* Only a single runtime environment (the Puppet commands) is currently implemented.
|
372
36
|
|
373
37
|
Restrictions of puppet:
|
@@ -377,25 +41,3 @@ Restrictions of puppet:
|
|
377
41
|
Future possibilities:
|
378
42
|
* [Multiple Providers](https://tickets.puppetlabs.com/browse/PDK-530)
|
379
43
|
* [Commands API](https://tickets.puppetlabs.com/browse/PDK-847)
|
380
|
-
|
381
|
-
### Cutting a release
|
382
|
-
|
383
|
-
In some cases we need to manually cut a release outside of the regular puppet
|
384
|
-
agent process.
|
385
|
-
|
386
|
-
To do so, follow these instructions from a current `master` checkout:
|
387
|
-
|
388
|
-
* Start the release branch with `git checkout -b release-prep`
|
389
|
-
* Update `lib/puppet/resource_api/version.rb` to the new version
|
390
|
-
* Update the CHANGELOG
|
391
|
-
* Have a [CHANGELOG_GITHUB_TOKEN](https://github.com/skywinder/github-changelog-generator#github-token) set in your environment
|
392
|
-
* run `rake changelog`
|
393
|
-
* double check the PRs to make sure they're all tagged correctly (using the new CHANGELOG for cross-checking)
|
394
|
-
* Check README and other materials for up-to-date-ness
|
395
|
-
* Commit changes with title "Release prep for \<VERSION>"
|
396
|
-
* Upload and PR the release-prep branch to the puppetlabs GitHub repo
|
397
|
-
* Check that CI is green and merge the PR
|
398
|
-
* Run `rake release[upstream]` to release from your checkout
|
399
|
-
* make sure to use the name of your git remote pointing to the puppetlabs GitHub repo
|
400
|
-
* Remove the release-prep branch
|
401
|
-
* Send the release announcements using the template in [misc/ANNOUNCEMENT_TEMPLATE.md](misc/ANNOUNCEMENT_TEMPLATE.md)
|
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.
|
4
|
+
version: 1.8.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Schmitt
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hocon
|
@@ -68,7 +68,6 @@ files:
|
|
68
68
|
- lib/puppet/resource_api/value_creator.rb
|
69
69
|
- lib/puppet/resource_api/version.rb
|
70
70
|
- lib/puppet/util/network_device/simple/device.rb
|
71
|
-
- misc/ANNOUNCEMENT_TEMPLATE.md
|
72
71
|
- puppet-resource_api.gemspec
|
73
72
|
homepage: https://github.com/puppetlabs/puppet-resource_api
|
74
73
|
licenses:
|
@@ -1,55 +0,0 @@
|
|
1
|
-
Send out announcements for major new feature releases and high-impact bugfixes.
|
2
|
-
|
3
|
-
For each release two announcements should be sent: an internal one and an external one.
|
4
|
-
|
5
|
-
Both emails must be sent from the puppet-product-updates@puppet.com email alias. You must add yourself to the alias in order to have rights to send the email from that alias.
|
6
|
-
|
7
|
-
### Internal email
|
8
|
-
Send from the puppet-product-updates@puppet.com email alias to the internal-puppet-product-updates email address. This will send the announcement to internal only people and most internal groups have been auto-subscribed to that list, so it should hit everyone in the organisation. It may include specific internal-only information, but most of the core content should be the same as the external email. Indeed, it is acceptable for both emails to be the same if there is no internal only information.
|
9
|
-
|
10
|
-
### External email
|
11
|
-
Send from the puppet-product-updates@puppet.com email alias to the following external aliases: <puppet-announce@googlegroups.com>, <puppet-dev@googlegroups.com>, <puppet-users@googlegroups.com>, <voxpupuli@groups.io>.
|
12
|
-
|
13
|
-
|
14
|
-
### Instructions on email content
|
15
|
-
Before sending, do check that all links are still valid. Feel free to adjust the text to match better with the circumstances of the release, or add other news that are relevant at the time. If you make changes, consider committing them here, for the benefit of future-you.
|
16
|
-
|
17
|
-
The github rendering of the markdown seems to copy&paste acceptably into Google Inbox.
|
18
|
-
|
19
|
-
The [CHANGELOG](https://github.com/puppetlabs/puppet-resource_api/blob/master/CHANGELOG.md) is a good starting point for finding enhancements and bug-fixes.
|
20
|
-
|
21
|
-
See [this post](https://groups.google.com/d/msg/puppet-dev/1R9gwkEIxHU/adWXJ0NfCAAJ) for an example.
|
22
|
-
|
23
|
-
---
|
24
|
-
|
25
|
-
Subject: [ANN] Resource API X.Y.Z Release
|
26
|
-
|
27
|
-
Hi all,
|
28
|
-
|
29
|
-
We're pleased to announce that version X.Y.Z of the Resource API is being released today.
|
30
|
-
|
31
|
-
The Resource API provides a simple way to create new native resources in the form of types and providers for Puppet. Using a little bit of ruby, you can finally get rid of that brittle exec, or manage that one API that eluded you until now.
|
32
|
-
|
33
|
-
It is provided as a Ruby gem to be referenced within modules. Support for it has been included as an experimental feature in the Puppet Development Kit (see `pdk new provider --help`). Use the [Puppet 6 packages](https://puppet.com/blog/introducing-puppet-6) or the [resource_api module](https://forge.puppet.com/puppetlabs/resource_api) to deploy it in your infrastructure. Note that if you are using Puppet 6 packages, you will have to wait until the next release to upgrade.
|
34
|
-
|
35
|
-
The new release of the Resource API provides the following enhancements:
|
36
|
-
|
37
|
-
* A
|
38
|
-
* B
|
39
|
-
* C
|
40
|
-
|
41
|
-
The new release also contains the following notable bugfixes:
|
42
|
-
|
43
|
-
* D
|
44
|
-
* E
|
45
|
-
* F
|
46
|
-
|
47
|
-
See the [CHANGELOG](https://github.com/puppetlabs/puppet-resource_api/blob/master/CHANGELOG.md) for a full list of changes.
|
48
|
-
|
49
|
-
We encourage all module developers to review the Resource API and use it when creating types and providers. The [README](https://github.com/puppetlabs/puppet-resource_api/blob/master/README.md) gets you going quickly. To see some example code see [this simple Philips Hue type](https://github.com/da-ar/hue_rsapi) or [the Palo Alto firewall module](https://github.com/puppetlabs/puppetlabs-panos).
|
50
|
-
|
51
|
-
Please let us know of your experiences with the Resource API, either here, on [Slack](https://slack.puppet.com/) (#forge-modules), or on the [github repo](https://github.com/puppetlabs/puppet-resource_api).
|
52
|
-
|
53
|
-
|
54
|
-
Thanks,
|
55
|
-
YOUR NAME
|