bolt 3.19.0 → 3.20.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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f615bd259875c82b953db516b48975c66863ef4f4002a4f55317f9f867a0cf6c
4
- data.tar.gz: 0027a9463d88e77455c7a83e5716f3097d921a32f172b931530b5f58827f427e
3
+ metadata.gz: cc5c8a79673414cca60534c299b63106ad7abe696bc942e7f913deaf57aa893f
4
+ data.tar.gz: 0db5d813eb99b4d452e92bde9d8518b10c60b5613a18cb310dffbc7c86c87d64
5
5
  SHA512:
6
- metadata.gz: 8c0d779b31ff416f05d625ba4effb197a7b453f02e19489220e228c3e35b20abf3bc04e85f09562faf8e0b12b415f20c8e6facfcded1d09212f45df2d2d73690
7
- data.tar.gz: d5ed05307adf5ff3c71d6db4a076b972284259aa837945eaf389d71434d795f90bb95efb783006fee32076b6311c8b4baad11627511cfad9957fa60f726de937
6
+ metadata.gz: 2d67559bf87d79ec2adf72b6cf1d7de11a6b3ad925062ff7251e4be99240e551e9704c2fff1767979351f4485420cd7a62988f4f31c8bfe6cae940272898f564
7
+ data.tar.gz: 69c73373a0ee02aca8794f66c48cc0c84f9c6ce56c329648915b6cc15714e399f13716f93af439a8362bc1a6c17d736e76e1920d2243fc1f1cf76e7daeb11a49
data/lib/bolt/cli.rb CHANGED
@@ -446,7 +446,7 @@ module Bolt
446
446
  check_gem_install
447
447
  warn_inventory_overrides_cli(config, options)
448
448
  submit_screen_view(analytics, config, inventory, options)
449
- options[:targets] = process_target_list(plugins.puppetdb_client, @rerun, options)
449
+ options[:targets] = process_target_list(plugins, @rerun, options)
450
450
 
451
451
  # TODO: Fix casing issue in Windows.
452
452
  config.check_path_case('modulepath', config.modulepath)
@@ -689,14 +689,14 @@ module Bolt
689
689
  # Process the target list by turning a PuppetDB query or rerun mode into a
690
690
  # list of target names.
691
691
  #
692
- # @param pdb_client [Bolt::PuppetDB::Client] The PuppetDB client.
692
+ # @param plugins [Bolt::Plugin] The Plugin instance.
693
693
  # @param rerun [Bolt::Rerun] The Rerun instance.
694
694
  # @param options [Hash] The CLI options.
695
695
  # @return [Hash] The target list.
696
696
  #
697
- private def process_target_list(pdb_client, rerun, options)
697
+ private def process_target_list(plugins, rerun, options)
698
698
  if options[:query]
699
- pdb_client.query_certnames(options[:query])
699
+ plugins.puppetdb_client.query_certnames(options[:query])
700
700
  elsif options[:rerun]
701
701
  rerun.get_targets(options[:rerun])
702
702
  elsif options[:targets]
@@ -155,14 +155,15 @@ module Bolt
155
155
  "`task.py`) and the extension is case sensitive. When a target's name is `localhost`, "\
156
156
  "Ruby tasks run with the Bolt Ruby interpreter by default.",
157
157
  additionalProperties: {
158
- type: String,
158
+ type: [String, Array],
159
159
  _plugin: false
160
160
  },
161
161
  propertyNames: {
162
162
  pattern: "^.?[a-zA-Z0-9]+$"
163
163
  },
164
164
  _plugin: true,
165
- _example: { "rb" => "/usr/bin/ruby" }
165
+ _example: { "rb" => ["/usr/bin/ruby", "-r", "puppet"],
166
+ ".py" => "/usr/bin/python3" }
166
167
  },
167
168
  "job-poll-interval" => {
168
169
  type: Integer,
@@ -100,7 +100,7 @@ module Bolt
100
100
 
101
101
  # Only use interpreter if script_interpreter config is enabled
102
102
  if options[:script_interpreter] && interpreter
103
- exec_args.unshift(interpreter)
103
+ exec_args.unshift(interpreter).flatten!
104
104
  logger.trace("Running '#{script}' using '#{interpreter}' interpreter")
105
105
  end
106
106
 
@@ -254,7 +254,7 @@ module Bolt
254
254
  if interpreter
255
255
  StringIO.new(<<~SCRIPT)
256
256
  #!/bin/sh
257
- '#{interpreter}' '#{task_path}' <<'EOF'
257
+ #{Array(interpreter).map { |word| "'#{word}'" }.join(' ')} '#{task_path}' <<'EOF'
258
258
  #{stdin}
259
259
  EOF
260
260
  SCRIPT
@@ -335,11 +335,7 @@ module Bolt
335
335
  # Returns string with the interpreter conditionally prepended
336
336
  def inject_interpreter(interpreter, command)
337
337
  if interpreter
338
- if command.is_a?(Array)
339
- command.unshift(interpreter)
340
- else
341
- command = [interpreter, command]
342
- end
338
+ command = Array(command).unshift(interpreter).flatten
343
339
  end
344
340
 
345
341
  command.is_a?(String) ? command : Shellwords.shelljoin(command)
@@ -214,8 +214,14 @@ module Bolt
214
214
  else
215
215
  interpreter = select_interpreter(script_path, target.options['interpreters'])
216
216
  if options[:script_interpreter] && interpreter
217
- path = interpreter
218
- args = escape_arguments([script_path])
217
+ # interpreter can be a String or Array here. Cast it to an array.
218
+ interpreter_array = Array(interpreter)
219
+ # Make path the first part of the array - this should be the binary
220
+ path = interpreter_array.shift
221
+ # Anything else in interpreters should get prepended to
222
+ # the command. If interpreters was a string this will
223
+ # just be [script_path]
224
+ args = escape_arguments(interpreter_array + Array(script_path))
219
225
  logger.trace("Running '#{script_path}' using '#{interpreter}' interpreter")
220
226
  else
221
227
  path, args = *process_from_extension(script_path)
@@ -268,8 +274,14 @@ module Bolt
268
274
  run_ps_task(task_path, arguments, input_method)
269
275
  else
270
276
  if (interpreter = select_interpreter(task_path, target.options['interpreters']))
271
- path = interpreter
272
- args = [task_path]
277
+ # interpreter can be a String or Array here. Cast it to an array.
278
+ interpreter_array = Array(interpreter)
279
+ # Make path the first part of the array - this should be the binary
280
+ path = interpreter_array.shift
281
+ # Anything else in interpreters should get prepended to
282
+ # the command. If interpreters was a string this will
283
+ # just be [task_path]
284
+ args = interpreter_array + [task_path]
273
285
  else
274
286
  path, args = *process_from_extension(task_path)
275
287
  end
data/lib/bolt/util.rb CHANGED
@@ -65,6 +65,9 @@ module Bolt
65
65
  raise Bolt::FileError.new("Could not parse #{file_name} file at #{path}, line #{e.line}, "\
66
66
  "column #{e.column}\n#{e.problem}",
67
67
  path)
68
+ rescue Psych::BadAlias => e
69
+ raise Bolt::FileError.new('Bolt does not support the use of aliases in YAML files. Alias '\
70
+ "detected in #{file_name} file at #{path}\n#{e.message}", path)
68
71
  rescue Psych::Exception => e
69
72
  raise Bolt::FileError.new("Could not parse #{file_name} file at #{path}\n#{e.message}",
70
73
  path)
data/lib/bolt/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bolt
4
- VERSION = '3.19.0'
4
+ VERSION = '3.20.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bolt
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.19.0
4
+ version: 3.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-04 00:00:00.000000000 Z
11
+ date: 2021-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -288,14 +288,14 @@ dependencies:
288
288
  requirements:
289
289
  - - "~>"
290
290
  - !ruby/object:Gem::Version
291
- version: '1.8'
291
+ version: '3.0'
292
292
  type: :runtime
293
293
  prerelease: false
294
294
  version_requirements: !ruby/object:Gem::Requirement
295
295
  requirements:
296
296
  - - "~>"
297
297
  - !ruby/object:Gem::Version
298
- version: '1.8'
298
+ version: '3.0'
299
299
  - !ruby/object:Gem::Dependency
300
300
  name: winrm
301
301
  requirement: !ruby/object:Gem::Requirement