bolt 3.21.0 → 3.22.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: 161a4fa9b8f36d32bd32964eeab21d3df8588e900f18999ee3ea9f0d56d56aec
4
- data.tar.gz: bd8e0f955123e73058904f8e22335a516f1f41dcb5e8bdf4e7ad9bc0c01fe212
3
+ metadata.gz: f5ed54ef60335c8ef24f0e5c76b3dbb669d2e4c83a36744d8d2efe090c2b72b0
4
+ data.tar.gz: 703e8adaa6f23ae4ac180370f4905844cb573b37c5449066e110167095fe15e3
5
5
  SHA512:
6
- metadata.gz: 7b27fc4df0159d56610a5c2ebadd0a78234bc4e88815b2705f1000400f786079bddbcff37544024a81bc221afc48c60cfd884d2cee7f18018df1644dc7370548
7
- data.tar.gz: 42c757fd3f406760d7b8d01809568270e92fb1ff57771ac07d392e26dd04be2f340a845906b7ea039e095e72e66bf37d56762b4e067db12eedb6773ffd47f492
6
+ metadata.gz: 2dfb2cf0b51cf238193d4e7b86933010d05a4985bc4df010c80dbcb9f8117d6dbb4359e81bacde3d567f61aae3b986d1d2e8c0c76a466c26a298bdc41c925bbf
7
+ data.tar.gz: fad359e9877901bebf721f2945425c62815bccfd5564125c45a545f3e45907d7fcb81a7d670c8cc54585596e173a4ebc960db5601495d69cebc0b5f449b368e1
@@ -461,6 +461,13 @@ module Bolt
461
461
  },
462
462
  _plugin: true
463
463
  },
464
+ "rerunfile" => {
465
+ description: "The path to the project's rerun file. The rerun file is used to store information "\
466
+ "about targets from the most recent run. Expands relative to the project directory.",
467
+ type: String,
468
+ _example: "/Users/bolt/project/rerun.json",
469
+ _plugin: true
470
+ },
464
471
  "save-rerun" => {
465
472
  description: "Whether to update `.rerun.json` in the Bolt project directory. If "\
466
473
  "your target names include passwords, set this value to `false` to avoid "\
@@ -630,6 +637,7 @@ module Bolt
630
637
  plugins
631
638
  policies
632
639
  puppetdb
640
+ rerunfile
633
641
  save-rerun
634
642
  spinner
635
643
  stream
data/lib/bolt/module.rb CHANGED
@@ -42,6 +42,12 @@ module Bolt
42
42
  end
43
43
 
44
44
  def plugin?
45
+ if File.exist?(File.join(path, 'bolt-plugin.json'))
46
+ msg = "Found bolt-plugin.json in module #{name} at #{path}. Bolt looks for " \
47
+ "bolt_plugin.json to determine if the module contains plugins. " \
48
+ "Rename the file for Bolt to recognize it."
49
+ Bolt::Logger.warn_once('plugin_file_name', msg)
50
+ end
45
51
  File.exist?(plugin_data_file)
46
52
  end
47
53
  end
@@ -1,8 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'json'
3
4
  module Bolt
4
5
  class Plugin
5
6
  class EnvVar
7
+ class InvalidPluginData < Bolt::Plugin::PluginError
8
+ def initialize(msg, plugin)
9
+ msg = "Invalid Plugin Data for #{plugin}: #{msg}"
10
+ super(msg, 'bolt/invalid-plugin-data')
11
+ end
12
+ end
13
+
6
14
  def initialize(*_args); end
7
15
 
8
16
  def name
@@ -31,7 +39,15 @@ module Bolt
31
39
  end
32
40
 
33
41
  def resolve_reference(opts)
34
- ENV[opts['var']] || opts['default']
42
+ reference = ENV[opts['var']]
43
+ if opts['json'] && reference
44
+ begin
45
+ reference = JSON.parse(reference)
46
+ rescue JSON::ParserError => e
47
+ raise InvalidPluginData.new(e.message, name)
48
+ end
49
+ end
50
+ reference || opts['default']
35
51
  end
36
52
  end
37
53
  end
@@ -42,6 +42,13 @@ module Bolt
42
42
 
43
43
  def fact_path(raw_fact)
44
44
  fact_path = raw_fact.split(".")
45
+ fact_path = fact_path.map do |segment|
46
+ # Turn it into an integer if we can
47
+ Integer(segment)
48
+ rescue ArgumentError
49
+ # Otherwise return the value
50
+ segment
51
+ end
45
52
  if fact_path[0] == 'facts'
46
53
  fact_path.drop(1)
47
54
  elsif fact_path == ['certname']
data/lib/bolt/project.rb CHANGED
@@ -128,6 +128,10 @@ module Bolt
128
128
 
129
129
  @data = data.slice(*Bolt::Config::PROJECT_OPTIONS)
130
130
 
131
+ if @data['rerunfile']
132
+ @rerunfile = File.expand_path(@data['rerunfile'], @path)
133
+ end
134
+
131
135
  validate if project_file?
132
136
  end
133
137
 
@@ -44,11 +44,12 @@ module Bolt
44
44
  end
45
45
 
46
46
  def ssh_opts
47
+ # NOTE: not all commands we might use here support various `-o` options,
48
+ # always provide a way to run without them.
47
49
  cmd = []
48
50
  # BatchMode is SSH's noninteractive option: if key authentication
49
51
  # fails it will error out instead of falling back to password prompt
50
- batch_mode = @target.transport_config['batch-mode'] ? 'yes' : 'no'
51
- cmd += %W[-o BatchMode=#{batch_mode}]
52
+ cmd += %w[-o BatchMode=yes] if @target.transport_config['batch-mode']
52
53
 
53
54
  cmd += %W[-o Port=#{@target.port}] if @target.port
54
55
 
@@ -68,6 +69,8 @@ module Bolt
68
69
  ssh_cmd = Array(ssh_conf)
69
70
  ssh_cmd += ssh_opts
70
71
  ssh_cmd << userhost
72
+ # Add option separator before command for wrappers around SSH
73
+ ssh_cmd << '--'
71
74
  ssh_cmd << command
72
75
  end
73
76
 
data/lib/bolt/util.rb CHANGED
@@ -344,7 +344,7 @@ module Bolt
344
344
 
345
345
  if !stat.readable?
346
346
  raise Bolt::FileError.new("The #{type} '#{path}' is unreadable", path)
347
- elsif !stat.file? && (!allow_dir || !stat.directory?)
347
+ elsif !allow_dir && stat.directory?
348
348
  expected = allow_dir ? 'file or directory' : 'file'
349
349
  raise Bolt::FileError.new("The #{type} '#{path}' is not a #{expected}", path)
350
350
  elsif stat.directory?
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.21.0'
4
+ VERSION = '3.22.0'
5
5
  end
@@ -326,6 +326,7 @@ module BoltServer
326
326
  cli << "--basemodulepath" << basemodulepath
327
327
  Puppet.settings.send(:clear_everything_for_tests)
328
328
  Puppet.initialize_settings(cli)
329
+ Puppet[:versioned_environment_dirs] = true
329
330
  yield
330
331
  end
331
332
  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.21.0
4
+ version: 3.22.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-12-16 00:00:00.000000000 Z
11
+ date: 2022-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -673,7 +673,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
673
673
  - !ruby/object:Gem::Version
674
674
  version: '0'
675
675
  requirements: []
676
- rubygems_version: 3.0.8
676
+ rubygems_version: 3.0.9
677
677
  signing_key:
678
678
  specification_version: 4
679
679
  summary: Execute commands remotely over SSH and WinRM