bolt 3.15.0 → 3.16.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.

data/lib/bolt/project.rb CHANGED
@@ -209,12 +209,5 @@ module Bolt
209
209
  Bolt::Logger.warn("missing_project_name", message)
210
210
  end
211
211
  end
212
-
213
- def check_deprecated_file
214
- if (@path + 'project.yaml').file?
215
- msg = "Project configuration file 'project.yaml' is deprecated; use 'bolt-project.yaml' instead."
216
- Bolt::Logger.warn("project_yaml", msg)
217
- end
218
- end
219
212
  end
220
213
  end
@@ -2,7 +2,8 @@
2
2
 
3
3
  module Bolt
4
4
  class ResultSet
5
- attr_reader :results
5
+ attr_accessor :elapsed_time
6
+ attr_reader :results
6
7
 
7
8
  include Enumerable
8
9
 
@@ -10,6 +10,8 @@ module Bolt
10
10
  module Transport
11
11
  class Local < Simple
12
12
  class Connection
13
+ RUBY_ENV_VARS = %w[GEM_PATH GEM_HOME RUBYLIB RUBYLIB_PREFIX RUBYOPT RUBYPATH RUBYSHELL].freeze
14
+
13
15
  attr_accessor :user, :logger, :target
14
16
 
15
17
  def initialize(target)
@@ -68,7 +70,21 @@ module Bolt
68
70
  end
69
71
  end
70
72
 
71
- Open3.popen3(*command)
73
+ # Only do this if bundled-ruby is set to false, not nil
74
+ ruby_env_vars = if target.transport_config['bundled-ruby'] == false
75
+ RUBY_ENV_VARS.each_with_object({}) do |e, acc|
76
+ acc[e] = ENV["BOLT_ORIG_#{e}"] if ENV["BOLT_ORIG_#{e}"]
77
+ end
78
+ end
79
+
80
+ if target.transport_config['bundled-ruby'] == false &&
81
+ Gem.loaded_specs.keys.include?('bundler')
82
+ Bundler.with_unbundled_env do
83
+ Open3.popen3(ruby_env_vars || {}, *command)
84
+ end
85
+ else
86
+ Open3.popen3(ruby_env_vars || {}, *command)
87
+ end
72
88
  end
73
89
 
74
90
  # This is used by the Bash shell to decide whether to `cd` before
@@ -36,7 +36,8 @@ module Bolt
36
36
  end
37
37
  logger.debug("Creating orchestrator client for #{client_opts}")
38
38
  @client = OrchestratorClient.new(client_opts, true)
39
- @plan_job = start_plan(plan_context)
39
+ @plan_context = plan_context
40
+ @plan_job = start_plan(@plan_context)
40
41
  logger.debug("Started plan #{@plan_job}")
41
42
  @environment = opts["task-environment"]
42
43
  end
@@ -87,6 +88,17 @@ module Bolt
87
88
  def run_task(targets, task, arguments, options)
88
89
  body = build_request(targets, task, arguments, options[:description])
89
90
  @client.run_task(body)
91
+ rescue OrchestratorClient::ApiError => e
92
+ if e.data['kind'] == 'puppetlabs.orchestrator/plan-already-finished'
93
+ @logger.debug("Retrying the task")
94
+ # Instead of recursing, just retry once
95
+ @plan_job = start_plan(@plan_context)
96
+ # Rebuild the request with the new plan job ID
97
+ body = build_request(targets, task, arguments, options[:description])
98
+ @client.run_task(body)
99
+ else
100
+ raise e
101
+ end
90
102
  end
91
103
 
92
104
  def query_inventory(targets)
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.15.0'
4
+ VERSION = '3.16.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.15.0
4
+ version: 3.16.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-08-02 00:00:00.000000000 Z
11
+ date: 2021-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -477,6 +477,7 @@ files:
477
477
  - guides/transports.yaml
478
478
  - lib/bolt.rb
479
479
  - lib/bolt/analytics.rb
480
+ - lib/bolt/application.rb
480
481
  - lib/bolt/applicator.rb
481
482
  - lib/bolt/apply_inventory.rb
482
483
  - lib/bolt/apply_result.rb
@@ -570,7 +571,6 @@ files:
570
571
  - lib/bolt/resource_instance.rb
571
572
  - lib/bolt/result.rb
572
573
  - lib/bolt/result_set.rb
573
- - lib/bolt/secret.rb
574
574
  - lib/bolt/shell.rb
575
575
  - lib/bolt/shell/bash.rb
576
576
  - lib/bolt/shell/bash/tmpdir.rb
data/lib/bolt/secret.rb DELETED
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bolt/plugin'
4
-
5
- module Bolt
6
- class Secret
7
- KNOWN_KEYS = {
8
- 'createkeys' => %w[keysize private_key public_key],
9
- 'encrypt' => %w[public_key],
10
- 'decrypt' => %w[private_key public_key]
11
- }.freeze
12
-
13
- def self.execute(plugins, outputter, options)
14
- name = options[:plugin] || 'pkcs7'
15
- plugin = plugins.by_name(name)
16
-
17
- unless plugin
18
- raise Bolt::Plugin::PluginError::Unknown, name
19
- end
20
-
21
- case options[:action]
22
- when 'createkeys'
23
- opts = { 'force' => options[:force] }.compact
24
- result = plugins.get_hook(name, :secret_createkeys).call(opts)
25
- outputter.print_message(result)
26
- when 'encrypt'
27
- encrypted = plugins.get_hook(name, :secret_encrypt).call('plaintext_value' => options[:object])
28
- outputter.print_message(encrypted)
29
- when 'decrypt'
30
- decrypted = plugins.get_hook(name, :secret_decrypt).call('encrypted_value' => options[:object])
31
- outputter.print_message(decrypted)
32
- end
33
-
34
- 0
35
- end
36
- end
37
- end