bolt 2.16.0 → 2.21.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bolt might be problematic. Click here for more details.

Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/Puppetfile +3 -1
  3. data/bolt-modules/boltlib/lib/puppet/functions/apply_prep.rb +20 -9
  4. data/bolt-modules/boltlib/lib/puppet/functions/download_file.rb +123 -0
  5. data/bolt-modules/boltlib/lib/puppet/functions/run_command.rb +2 -0
  6. data/bolt-modules/boltlib/lib/puppet/functions/run_plan.rb +6 -0
  7. data/bolt-modules/boltlib/lib/puppet/functions/run_script.rb +6 -4
  8. data/bolt-modules/dir/lib/puppet/functions/dir/children.rb +35 -0
  9. data/lib/bolt/applicator.rb +19 -14
  10. data/lib/bolt/apply_result.rb +1 -1
  11. data/lib/bolt/bolt_option_parser.rb +60 -16
  12. data/lib/bolt/catalog.rb +3 -2
  13. data/lib/bolt/cli.rb +121 -43
  14. data/lib/bolt/config.rb +37 -34
  15. data/lib/bolt/config/options.rb +340 -173
  16. data/lib/bolt/config/transport/options.rb +315 -160
  17. data/lib/bolt/config/transport/ssh.rb +24 -10
  18. data/lib/bolt/executor.rb +21 -0
  19. data/lib/bolt/inventory/group.rb +3 -2
  20. data/lib/bolt/inventory/inventory.rb +4 -3
  21. data/lib/bolt/logger.rb +24 -1
  22. data/lib/bolt/outputter.rb +1 -1
  23. data/lib/bolt/outputter/rainbow.rb +14 -3
  24. data/lib/bolt/pal.rb +28 -10
  25. data/lib/bolt/pal/yaml_plan/evaluator.rb +23 -2
  26. data/lib/bolt/pal/yaml_plan/step.rb +24 -2
  27. data/lib/bolt/pal/yaml_plan/step/download.rb +38 -0
  28. data/lib/bolt/pal/yaml_plan/step/message.rb +30 -0
  29. data/lib/bolt/pal/yaml_plan/step/upload.rb +3 -3
  30. data/lib/bolt/plugin/module.rb +2 -4
  31. data/lib/bolt/plugin/puppetdb.rb +3 -2
  32. data/lib/bolt/project.rb +20 -6
  33. data/lib/bolt/puppetdb/client.rb +2 -0
  34. data/lib/bolt/puppetdb/config.rb +16 -0
  35. data/lib/bolt/result.rb +7 -0
  36. data/lib/bolt/shell/bash.rb +45 -37
  37. data/lib/bolt/shell/powershell.rb +21 -11
  38. data/lib/bolt/shell/powershell/snippets.rb +15 -6
  39. data/lib/bolt/transport/base.rb +24 -0
  40. data/lib/bolt/transport/docker.rb +16 -4
  41. data/lib/bolt/transport/docker/connection.rb +20 -2
  42. data/lib/bolt/transport/local/connection.rb +14 -1
  43. data/lib/bolt/transport/orch.rb +20 -0
  44. data/lib/bolt/transport/simple.rb +6 -0
  45. data/lib/bolt/transport/ssh.rb +7 -1
  46. data/lib/bolt/transport/ssh/connection.rb +9 -1
  47. data/lib/bolt/transport/ssh/exec_connection.rb +23 -2
  48. data/lib/bolt/transport/winrm/connection.rb +118 -8
  49. data/lib/bolt/util.rb +26 -11
  50. data/lib/bolt/version.rb +1 -1
  51. data/lib/bolt_server/transport_app.rb +3 -2
  52. data/lib/bolt_spec/bolt_context.rb +7 -2
  53. data/lib/bolt_spec/plans.rb +15 -2
  54. data/lib/bolt_spec/plans/action_stubs.rb +2 -1
  55. data/lib/bolt_spec/plans/action_stubs/download_stub.rb +66 -0
  56. data/lib/bolt_spec/plans/mock_executor.rb +14 -1
  57. data/lib/bolt_spec/run.rb +22 -0
  58. data/libexec/bolt_catalog +3 -2
  59. data/modules/secure_env_vars/plans/init.pp +20 -0
  60. metadata +21 -29
@@ -6,290 +6,445 @@ module Bolt
6
6
  module Options
7
7
  LOGIN_SHELLS = %w[sh bash zsh dash ksh powershell].freeze
8
8
 
9
- # The following constant defines the various configuration options available to Bolt's.
10
- # transports. Each key is a configuration option and values are the data describing the
11
- # option. Data includes the following keys:
12
- # :def The **documented** default value. This is the value that is displayed
13
- # in the reference docs and is not used by Bolt to actually set a default
14
- # value.
15
- # :desc The text description of the option that is displayed in documentation.
16
- # :exmp An example value for the option. This is used to generate an example
17
- # configuration file in the reference docs.
18
- # :type The option's expected type. If an option accepts multiple types, this is
19
- # an array of the accepted types. Any options that accept a Boolean value
20
- # should use the [TrueClass, FalseClass] type.
9
+ # The following constants define the various configuration options available to Bolt's
10
+ # transports. Each constant is a hash where keys are the configuration option and values
11
+ # are the option's definition. These options are used in multiple locations:
21
12
  #
22
- # NOTE: All transport configuration options should have a corresponding schema definition
23
- # in schemas/bolt-transport-definitions.json
13
+ # - Automatic type validation when loading and setting configuration
14
+ # - Generating reference documentation for configuration files
15
+ # - Generating JSON schemas for configuration files
16
+ #
17
+ # Data includes keys defined by JSON Schema Draft 07 as well as some metadata used
18
+ # by Bolt to generate documentation. The following keys are used:
19
+ #
20
+ # :description String A detailed description of the option and what it does. This
21
+ # field is used in both documentation and the JSON schemas,
22
+ # and should provide as much detail as possible, including
23
+ # links to relevant documentation.
24
+ #
25
+ # :type Class The expected type of a value. These should be Ruby classes,
26
+ # as this field is used to perform automatic type validation.
27
+ # If an option can accept more than one type, this should be
28
+ # an array of types. Boolean values should set :type to
29
+ # [TrueClass, FalseClass], as Ruby does not have a single
30
+ # Boolean class.
31
+ #
32
+ # :items Hash A definition hash for items in an array. Similar to values
33
+ # for top-level options, items can have a :description, :type,
34
+ # or any other key in this list.
35
+ #
36
+ # :uniqueItems Boolean Whether or not an array should contain only unique items.
37
+ #
38
+ # :properties Hash A hash where keys are sub-options and values are definitions
39
+ # for the sub-option. Similar to values for top-level options,
40
+ # properties can have a :description, :type, or any other key
41
+ # in this list.
42
+ #
43
+ # :additionalProperties A variation of the :properties key, where the hash is a
44
+ # Hash definition for any properties not specified in :properties.
45
+ # This can be used to permit arbitrary sub-options, such as
46
+ # logs for the 'log' option.
47
+ #
48
+ # :propertyNames Hash A hash that defines the properties that an option's property
49
+ # names must adhere to.
50
+ #
51
+ # :required Array An array of properties that are required for options that
52
+ # accept Hash values.
53
+ #
54
+ # :minimum Integer The minimum integer value for an option.
55
+ #
56
+ # :enum Array An array of values that the option recognizes.
57
+ #
58
+ # :pattern String A JSON regex pattern that the option's vaue should match.
59
+ #
60
+ # :format String Requires that a string value matches a format defined by the
61
+ # JSON Schema draft.
62
+ #
63
+ # :_plugin Boolean Whether the option accepts a plugin reference. This is used
64
+ # when generating the JSON schemas to determine whether or not
65
+ # to include a reference to the _plugin definition. If :_plugin
66
+ # is set to true, the script that generates JSON schemas will
67
+ # automatically recurse through the :items and :properties keys
68
+ # and add plugin references if applicable.
69
+ #
70
+ # :_example Any An example value for the option. This is used to generate
71
+ # reference documentation for configuration files.
72
+ #
73
+ # :_default Any The documented default value for the option. This is only
74
+ # used to generate reference documentation for configuration
75
+ # files and is not used by Bolt to actually set default values.
24
76
  TRANSPORT_OPTIONS = {
25
77
  "basic-auth-only" => {
26
78
  type: [TrueClass, FalseClass],
27
- desc: "Whether to force basic authentication. This option is only available when using SSL.",
28
- def: false,
29
- exmp: true
79
+ description: "Whether to force basic authentication. This option is only available when using SSL.",
80
+ _plugin: true,
81
+ _default: false,
82
+ _example: true
30
83
  },
31
84
  "cacert" => {
32
85
  type: String,
33
- desc: "The path to the CA certificate.",
34
- exmp: "~/.puppetlabs/puppet/cert.pem"
86
+ description: "The path to the CA certificate.",
87
+ _plugin: true,
88
+ _example: "~/.puppetlabs/puppet/cert.pem"
35
89
  },
36
90
  "cleanup" => {
37
91
  type: [TrueClass, FalseClass],
38
- desc: "Whether to clean up temporary files created on targets. When running commands on a target, "\
39
- "Bolt may create temporary files. After completing the command, these files are automatically "\
40
- "deleted. This value can be set to 'false' if you wish to leave these temporary files on the "\
41
- "target.",
42
- def: true,
43
- exmp: false
92
+ description: "Whether to clean up temporary files created on targets. When running commands on a target, "\
93
+ "Bolt may create temporary files. After completing the command, these files are "\
94
+ "automatically deleted. This value can be set to 'false' if you wish to leave these "\
95
+ "temporary files on the target.",
96
+ _plugin: true,
97
+ _default: true,
98
+ _example: false
44
99
  },
45
100
  "connect-timeout" => {
46
101
  type: Integer,
47
- desc: "How long to wait in seconds when establishing connections. Set this value higher if you "\
48
- "frequently encounter connection timeout errors when running Bolt.",
49
- def: 10,
50
- exmp: 15
102
+ description: "How long to wait in seconds when establishing connections. Set this value higher if you "\
103
+ "frequently encounter connection timeout errors when running Bolt.",
104
+ minimum: 1,
105
+ _plugin: true,
106
+ _default: 10,
107
+ _example: 15
51
108
  },
52
109
  "copy-command" => {
53
110
  type: [Array, String],
54
- desc: "The command to use when copying files using ssh-command. Bolt runs `<copy-command> <src> <dest>`. "\
55
- "This option is used when you need support for features or algorithms that are not supported "\
56
- "by the net-ssh Ruby library. **This option is experimental.** You can read more about this "\
57
- "option in [External SSH transport](experimental_features.md#external-ssh-transport).",
58
- def: "scp -r",
59
- exmp: "scp -r -F ~/ssh-config/myconf"
111
+ description: "The command to use when copying files using native SSH. Bolt runs `<copy-command> <src> "\
112
+ "<dest>`. This option is used when you need support for features or algorithms that are not "\
113
+ "supported by the net-ssh Ruby library. **This option is experimental.** You can read more "\
114
+ "about this option in [Native SSH transport](experimental_features.md#native-ssh-transport).",
115
+ items: {
116
+ type: String
117
+ },
118
+ _plugin: true,
119
+ _default: %w[scp -r],
120
+ _example: %w[scp -r -F ~/ssh-config/myconf]
60
121
  },
61
122
  "disconnect-timeout" => {
62
123
  type: Integer,
63
- desc: "How long to wait in seconds before force-closing a connection.",
64
- def: 5,
65
- exmp: 10
124
+ description: "How long to wait in seconds before force-closing a connection.",
125
+ minimum: 1,
126
+ _plugin: true,
127
+ _default: 5,
128
+ _example: 10
66
129
  },
67
130
  "encryption-algorithms" => {
68
131
  type: Array,
69
- desc: "A list of encryption algorithms to use when establishing a connection "\
70
- "to a target. Supported algorithms are defined by the Ruby net-ssh library and can be "\
71
- "viewed [here](https://github.com/net-ssh/net-ssh#supported-algorithms). All supported, "\
72
- "non-deprecated algorithms are available by default when this option is not used. To "\
73
- "reference all default algorithms using this option, add 'defaults' to the list of "\
74
- "supported algorithms.",
75
- exmp: %w[defaults idea-cbc]
132
+ description: "A list of encryption algorithms to use when establishing a connection "\
133
+ "to a target. Supported algorithms are defined by the Ruby net-ssh library and can be "\
134
+ "viewed [here](https://github.com/net-ssh/net-ssh#supported-algorithms). All supported, "\
135
+ "non-deprecated algorithms are available by default when this option is not used. To "\
136
+ "reference all default algorithms using this option, add 'defaults' to the list of "\
137
+ "supported algorithms.",
138
+ uniqueItems: true,
139
+ items: {
140
+ type: String
141
+ },
142
+ _plugin: true,
143
+ _example: %w[defaults idea-cbc]
76
144
  },
77
145
  "extensions" => {
78
146
  type: Array,
79
- desc: "A list of file extensions that are accepted for scripts or tasks on "\
80
- "Windows. Scripts with these file extensions rely on the target's file "\
81
- "type association to run. For example, if Python is installed on the "\
82
- "system, a `.py` script runs with `python.exe`. The extensions `.ps1`, "\
83
- "`.rb`, and `.pp` are always allowed and run via hard-coded "\
84
- "executables.",
85
- exmp: [".sh"]
147
+ description: "A list of file extensions that are accepted for scripts or tasks on "\
148
+ "Windows. Scripts with these file extensions rely on the target's file "\
149
+ "type association to run. For example, if Python is installed on the "\
150
+ "system, a `.py` script runs with `python.exe`. The extensions `.ps1`, "\
151
+ "`.rb`, and `.pp` are always allowed and run via hard-coded "\
152
+ "executables.",
153
+ uniqueItems: true,
154
+ items: {
155
+ type: String
156
+ },
157
+ _plugin: true,
158
+ _example: [".sh"]
86
159
  },
87
160
  "file-protocol" => {
88
161
  type: String,
89
- desc: "Which file transfer protocol to use. Either `winrm` or `smb`. Using `smb` is "\
90
- "recommended for large file transfers.",
91
- def: "winrm",
92
- exmp: "smb"
162
+ description: "Which file transfer protocol to use. Either `winrm` or `smb`. Using `smb` is "\
163
+ "recommended for large file transfers.",
164
+ enum: %w[smb winrm],
165
+ _plugin: true,
166
+ _default: "winrm",
167
+ _example: "smb"
93
168
  },
94
169
  "host" => {
95
170
  type: String,
96
- desc: "The target's hostname.",
97
- exmp: "docker_host_production"
171
+ description: "The target's hostname.",
172
+ _plugin: true,
173
+ _example: "docker_host_production"
98
174
  },
99
175
  "host-key-algorithms" => {
100
176
  type: Array,
101
- desc: "A list of host key algorithms to use when establishing a connection "\
102
- "to a target. Supported algorithms are defined by the Ruby net-ssh library and can be "\
103
- "viewed [here](https://github.com/net-ssh/net-ssh#supported-algorithms). All supported, "\
104
- "non-deprecated algorithms are available by default when this option is not used. To "\
105
- "reference all default algorithms using this option, add 'defaults' to the list of "\
106
- "supported algorithms.",
107
- exmp: %w[defaults ssh-dss]
177
+ description: "A list of host key algorithms to use when establishing a connection "\
178
+ "to a target. Supported algorithms are defined by the Ruby net-ssh library and can be "\
179
+ "viewed [here](https://github.com/net-ssh/net-ssh#supported-algorithms). All supported, "\
180
+ "non-deprecated algorithms are available by default when this option is not used. To "\
181
+ "reference all default algorithms using this option, add 'defaults' to the list of "\
182
+ "supported algorithms.",
183
+ uniqueItems: true,
184
+ items: {
185
+ type: String
186
+ },
187
+ _plugin: true,
188
+ _example: %w[defaults ssh-dss]
108
189
  },
109
190
  "host-key-check" => {
110
191
  type: [TrueClass, FalseClass],
111
- desc: "Whether to perform host key validation when connecting.",
112
- exmp: false
192
+ description: "Whether to perform host key validation when connecting.",
193
+ _plugin: true,
194
+ _example: false
113
195
  },
114
196
  "interpreters" => {
115
197
  type: Hash,
116
- desc: "A map of an extension name to the absolute path of an executable, enabling you to override "\
117
- "the shebang defined in a task executable. The extension can optionally be specified with the "\
118
- "`.` character (`.py` and `py` both map to a task executable `task.py`) and the extension is "\
119
- "case sensitive. When a target's name is `localhost`, Ruby tasks run with the Bolt Ruby "\
120
- "interpreter by default.",
121
- exmp: { "rb" => "/usr/bin/ruby" }
198
+ description: "A map of an extension name to the absolute path of an executable, enabling you to "\
199
+ "override the shebang defined in a task executable. The extension can optionally be "\
200
+ "specified with the `.` character (`.py` and `py` both map to a task executable "\
201
+ "`task.py`) and the extension is case sensitive. When a target's name is `localhost`, "\
202
+ "Ruby tasks run with the Bolt Ruby interpreter by default.",
203
+ additionalProperties: {
204
+ type: String
205
+ },
206
+ propertyNames: {
207
+ pattern: "^.?[a-zA-Z0-9]+$"
208
+ },
209
+ _plugin: true,
210
+ _example: { "rb" => "/usr/bin/ruby" }
122
211
  },
123
212
  "job-poll-interval" => {
124
213
  type: Integer,
125
- desc: "The interval, in seconds, to poll orchestrator for job status.",
126
- exmp: 2
214
+ description: "The interval, in seconds, to poll orchestrator for job status.",
215
+ minimum: 1,
216
+ _plugin: true,
217
+ _example: 2
127
218
  },
128
219
  "job-poll-timeout" => {
129
220
  type: Integer,
130
- desc: "The time, in seconds, to wait for orchestrator job status.",
131
- exmp: 2000
221
+ description: "The time, in seconds, to wait for orchestrator job status.",
222
+ minimum: 1,
223
+ _plugin: true,
224
+ _example: 2000
132
225
  },
133
226
  "kex-algorithms" => {
134
227
  type: Array,
135
- desc: "A list of key exchange algorithms to use when establishing a connection "\
136
- "to a target. Supported algorithms are defined by the Ruby net-ssh library and can be "\
137
- "viewed [here](https://github.com/net-ssh/net-ssh#supported-algorithms). All supported, "\
138
- "non-deprecated algorithms are available by default when this option is not used. To "\
139
- "reference all default algorithms using this option, add 'defaults' to the list of "\
140
- "supported algorithms.",
141
- exmp: %w[defaults diffie-hellman-group1-sha1]
228
+ description: "A list of key exchange algorithms to use when establishing a connection "\
229
+ "to a target. Supported algorithms are defined by the Ruby net-ssh library and can be "\
230
+ "viewed [here](https://github.com/net-ssh/net-ssh#supported-algorithms). All supported, "\
231
+ "non-deprecated algorithms are available by default when this option is not used. To "\
232
+ "reference all default algorithms using this option, add 'defaults' to the list of "\
233
+ "supported algorithms.",
234
+ uniqueItems: true,
235
+ items: {
236
+ type: String
237
+ },
238
+ _plugin: true,
239
+ _example: %w[defaults diffie-hellman-group1-sha1]
142
240
  },
143
241
  "load-config" => {
144
242
  type: [TrueClass, FalseClass],
145
- desc: "Whether to load system SSH configuration from '~/.ssh/config' and '/etc/ssh_config'.",
146
- def: true,
147
- exmp: false
243
+ description: "Whether to load system SSH configuration from '~/.ssh/config' and '/etc/ssh_config'.",
244
+ _plugin: true,
245
+ _default: true,
246
+ _example: false
148
247
  },
149
248
  "login-shell" => {
150
249
  type: String,
151
- desc: "Which login shell Bolt should expect on the target. Supported shells are " \
152
- "#{LOGIN_SHELLS.join(', ')}. **This option is experimental.**",
153
- def: "bash",
154
- exmp: "powershell"
250
+ description: "Which login shell Bolt should expect on the target. Supported shells are " \
251
+ "#{LOGIN_SHELLS.join(', ')}. **This option is experimental.**",
252
+ enum: LOGIN_SHELLS,
253
+ _plugin: true,
254
+ _default: "bash",
255
+ _example: "powershell"
155
256
  },
156
257
  "mac-algorithms" => {
157
258
  type: Array,
158
- desc: "List of message authentication code algorithms to use when establishing a connection "\
159
- "to a target. Supported algorithms are defined by the Ruby net-ssh library and can be "\
160
- "viewed [here](https://github.com/net-ssh/net-ssh#supported-algorithms). All supported, "\
161
- "non-deprecated algorithms are available by default when this option is not used. To "\
162
- "reference all default algorithms using this option, add 'defaults' to the list of "\
163
- "supported algorithms.",
164
- exmp: %w[defaults hmac-md5]
259
+ description: "List of message authentication code algorithms to use when establishing a connection "\
260
+ "to a target. Supported algorithms are defined by the Ruby net-ssh library and can be "\
261
+ "viewed [here](https://github.com/net-ssh/net-ssh#supported-algorithms). All supported, "\
262
+ "non-deprecated algorithms are available by default when this option is not used. To "\
263
+ "reference all default algorithms using this option, add 'defaults' to the list of "\
264
+ "supported algorithms.",
265
+ uniqueItems: true,
266
+ items: {
267
+ type: String
268
+ },
269
+ _plugin: true,
270
+ _example: %w[defaults hmac-md5]
271
+ },
272
+ "native-ssh" => {
273
+ type: [TrueClass, FalseClass],
274
+ description: "This enables the native SSH transport, which shells out to SSH instead of using the "\
275
+ "net-ssh Ruby library",
276
+ _default: false,
277
+ _example: true
165
278
  },
166
279
  "password" => {
167
280
  type: String,
168
- desc: "The password to use to login.",
169
- exmp: "hunter2!"
281
+ description: "The password to use to login.",
282
+ _plugin: true,
283
+ _example: "hunter2!"
170
284
  },
171
285
  "port" => {
172
286
  type: Integer,
173
- desc: "The port to use when connecting to the target.",
174
- exmp: 22
287
+ description: "The port to use when connecting to the target.",
288
+ minimum: 0,
289
+ _plugin: true,
290
+ _example: 22
175
291
  },
176
292
  "private-key" => {
177
293
  type: [Hash, String],
178
- desc: "Either the path to the private key file to use for authentication, or "\
179
- "a hash with the key `key-data` and the contents of the private key.",
180
- exmp: "~/.ssh/id_rsa"
294
+ description: "Either the path to the private key file to use for authentication, or "\
295
+ "a hash with the key `key-data` and the contents of the private key.",
296
+ required: ["key-data"],
297
+ properties: {
298
+ "key-data" => {
299
+ description: "The contents of the private key.",
300
+ type: String
301
+ }
302
+ },
303
+ _plugin: true,
304
+ _example: "~/.ssh/id_rsa"
181
305
  },
182
306
  "proxyjump" => {
183
307
  type: String,
184
- desc: "A jump host to proxy connections through, and an optional user to connect with.",
185
- exmp: "jump.example.com"
308
+ description: "A jump host to proxy connections through, and an optional user to connect with.",
309
+ format: "uri",
310
+ _plugin: true,
311
+ _example: "jump.example.com"
186
312
  },
187
313
  "realm" => {
188
314
  type: String,
189
- desc: "The Kerberos realm (Active Directory domain) to authenticate against.",
190
- exmp: "BOLT.PRODUCTION"
315
+ description: "The Kerberos realm (Active Directory domain) to authenticate against.",
316
+ _plugin: true,
317
+ _example: "BOLT.PRODUCTION"
191
318
  },
192
319
  "run-as" => {
193
320
  type: String,
194
- desc: "The user to run commands as after login. The run-as user must be different than the login user.",
195
- exmp: "root"
321
+ description: "The user to run commands as after login. The run-as user must be different than the "\
322
+ "login user.",
323
+ _plugin: true,
324
+ _example: "root"
196
325
  },
197
326
  "run-as-command" => {
198
327
  type: Array,
199
- desc: "The command to elevate permissions. Bolt appends the user and command strings to the configured "\
200
- "`run-as-command` before running it on the target. This command must not require an interactive "\
201
- "password prompt, and the `sudo-password` option is ignored when `run-as-command` is specified. "\
202
- "The `run-as-command` must be specified as an array.",
203
- exmp: ["sudo", "-nkSEu"]
328
+ description: "The command to elevate permissions. Bolt appends the user and command strings to the "\
329
+ "configured `run-as-command` before running it on the target. This command must not require "\
330
+ " aninteractive password prompt, and the `sudo-password` option is ignored when "\
331
+ "`run-as-command` is specified. The `run-as-command` must be specified as an array.",
332
+ items: {
333
+ type: String
334
+ },
335
+ _plugin: true,
336
+ _example: ["sudo", "-nkSEu"]
204
337
  },
205
338
  "run-on" => {
206
339
  type: String,
207
- desc: "The proxy target that the task executes on.",
208
- def: "localhost",
209
- exmp: "proxy_target"
340
+ description: "The proxy target that the task executes on.",
341
+ format: "uri",
342
+ _plugin: true,
343
+ _default: "localhost",
344
+ _example: "proxy_target"
210
345
  },
211
346
  "script-dir" => {
212
347
  type: String,
213
- desc: "The subdirectory of the tmpdir to use in place of a randomized "\
214
- "subdirectory for uploading and executing temporary files on the "\
215
- "target. It's expected that this directory already exists as a subdir "\
216
- "of tmpdir, which is either configured or defaults to `/tmp`.",
217
- exmp: "bolt_scripts"
348
+ description: "The subdirectory of the tmpdir to use in place of a randomized "\
349
+ "subdirectory for uploading and executing temporary files on the "\
350
+ "target. It's expected that this directory already exists as a subdir "\
351
+ "of tmpdir, which is either configured or defaults to `/tmp`.",
352
+ _plugin: true,
353
+ _example: "bolt_scripts"
218
354
  },
219
355
  "service-url" => {
220
356
  type: String,
221
- desc: "The URL of the host used for API requests.",
222
- exmp: "https://api.example.com"
357
+ description: "The URL of the host used for API requests.",
358
+ format: "uri",
359
+ _plugin: true,
360
+ _example: "https://api.example.com"
223
361
  },
224
362
  "shell-command" => {
225
363
  type: String,
226
- desc: "A shell command to wrap any Docker exec commands in, such as `bash -lc`.",
227
- exmp: "bash -lc"
364
+ description: "A shell command to wrap any Docker exec commands in, such as `bash -lc`.",
365
+ _plugin: true,
366
+ _example: "bash -lc"
228
367
  },
229
368
  "smb-port" => {
230
369
  type: Integer,
231
- desc: "The port to use when connecting to the target when file-protocol is set to 'smb'.",
232
- exmp: 445
370
+ description: "The port to use when connecting to the target when file-protocol is set to 'smb'.",
371
+ minimum: 0,
372
+ _plugin: true,
373
+ _example: 445
233
374
  },
234
375
  "ssh-command" => {
235
376
  type: [Array, String],
236
- desc: "The command and flags to use when SSHing. This enables the external SSH transport, which "\
237
- "shells out to the specified command. This option is used when you need support for "\
238
- "features or algorithms that are not supported by the net-ssh Ruby library. **This option is "\
239
- "experimental.** You can read more about this option in [External SSH "\
240
- "transport](experimental_features.md#external-ssh-transport).",
241
- exmp: "ssh"
377
+ description: "The command and flags to use when SSHing. This option is used when you need support for "\
378
+ "features or algorithms that are not supported by the net-ssh Ruby library. **This option "\
379
+ "is experimental.** You can read more about this option in [Native SSH "\
380
+ "transport](experimental_features.md#native-ssh-transport).",
381
+ items: {
382
+ type: String
383
+ },
384
+ _plugin: true,
385
+ _default: 'ssh',
386
+ _example: %w[ssh -o Ciphers=chacha20-poly1305@openssh.com]
242
387
  },
243
388
  "ssl" => {
244
389
  type: [TrueClass, FalseClass],
245
- desc: "Whether to use secure https connections for WinRM.",
246
- def: true,
247
- exmp: false
390
+ description: "Whether to use secure https connections for WinRM.",
391
+ _plugin: true,
392
+ _default: true,
393
+ _example: false
248
394
  },
249
395
  "ssl-verify" => {
250
396
  type: [TrueClass, FalseClass],
251
- desc: "Whether to verify that the target's certificate matches the cacert.",
252
- def: true,
253
- exmp: false
397
+ description: "Whether to verify that the target's certificate matches the cacert.",
398
+ _plugin: true,
399
+ _default: true,
400
+ _example: false
254
401
  },
255
402
  "sudo-executable" => {
256
403
  type: String,
257
- desc: "The executable to use when escalating to the configured `run-as` user. This is useful when you "\
258
- "want to escalate using the configured `sudo-password`, since `run-as-command` does not use "\
259
- "`sudo-password` or support prompting. The command executed on the target is `<sudo-executable> "\
260
- "-S -u <user> -p custom_bolt_prompt <command>`. **This option is experimental.**",
261
- exmp: "dzdo"
404
+ description: "The executable to use when escalating to the configured `run-as` user. This is useful "\
405
+ "when you want to escalate using the configured `sudo-password`, since `run-as-command` "\
406
+ "does not use `sudo-password` or support prompting. The command executed on the target "\
407
+ "is `<sudo-executable> -S -u <user> -p custom_bolt_prompt <command>`. **This option is "\
408
+ "experimental.**",
409
+ _plugin: true,
410
+ _example: "dzdo"
262
411
  },
263
412
  "sudo-password" => {
264
413
  type: String,
265
- desc: "The password to use when changing users via `run-as`.",
266
- exmp: "p@$$w0rd!"
414
+ description: "The password to use when changing users via `run-as`.",
415
+ _plugin: true,
416
+ _example: "p@$$w0rd!"
267
417
  },
268
418
  "task-environment" => {
269
419
  type: String,
270
- desc: "The environment the orchestrator loads task code from.",
271
- def: "production",
272
- exmp: "development"
420
+ description: "The environment the orchestrator loads task code from.",
421
+ _plugin: true,
422
+ _default: "production",
423
+ _example: "development"
273
424
  },
274
425
  "tmpdir" => {
275
426
  type: String,
276
- desc: "The directory to upload and execute temporary files on the target.",
277
- exmp: "/tmp/bolt"
427
+ description: "The directory to upload and execute temporary files on the target.",
428
+ _plugin: true,
429
+ _example: "/tmp/bolt"
278
430
  },
279
431
  "token-file" => {
280
432
  type: String,
281
- desc: "The path to the token file.",
282
- exmp: "~/.puppetlabs/puppet/token.pem"
433
+ description: "The path to the token file.",
434
+ _plugin: true,
435
+ _example: "~/.puppetlabs/puppet/token.pem"
283
436
  },
284
437
  "tty" => {
285
438
  type: [TrueClass, FalseClass],
286
- desc: "Whether to enable tty on exec commands.",
287
- exmp: true
439
+ description: "Whether to enable tty on exec commands.",
440
+ _plugin: true,
441
+ _example: true
288
442
  },
289
443
  "user" => {
290
444
  type: String,
291
- desc: "The user name to login as.",
292
- exmp: "bolt"
445
+ description: "The user name to login as.",
446
+ _plugin: true,
447
+ _example: "bolt"
293
448
  }
294
449
  }.freeze
295
450