bolt 2.10.0 → 2.11.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: 4f0e265eb792ba38e627651fad94478a4acbcbf7576912b95f6eaa0b234e6957
4
- data.tar.gz: ad28f917ac186069e61300142dad31373b4a09dd484a3d131962d383b803d43a
3
+ metadata.gz: ffe8fa93c2b9de411d9c2ef46c6c68deae3e10c7b711451dd1acf12034952b31
4
+ data.tar.gz: 4892ece130a2c4c8d70aa6315df85c13be920c290c2e337dddf2b493180bea58
5
5
  SHA512:
6
- metadata.gz: 9b915748121d6081207a1afac60768008fc752f545ca722c403b58efbb96303417d3add08d8aaf1fd299770fd1202461f2759224b7bdf19592a9f6e5c277705c
7
- data.tar.gz: 5c25c74ee7e7f7c39e1eb125e5b39fb0fcbefceb6ede50b8c364cacb19bf1eb20cd70dc80d24422e9590d8d8720b7fc25b3b98e147c4c4dee646ffc441d7154b
6
+ metadata.gz: b95e67238b0af8b5ded1c2f14f1514fb5ab715ae43afbca3247c4f4224d7f403385e0b3f6072babbc90faeb8bcaa4d7cc0b79319258f509340fe765c3e9e13b7
7
+ data.tar.gz: 9e1584102d3b103632e36d9c922df007c9b780d69a088b964ef59ff4162e94abdc12693e61fea42c5256a97ebf245e2dd4222d4019d98db2d658a10b4f15e317
data/Puppetfile CHANGED
@@ -24,7 +24,7 @@ mod 'puppetlabs-zone_core', '1.0.3'
24
24
  # Useful additional modules
25
25
  mod 'puppetlabs-package', '1.1.0'
26
26
  mod 'puppetlabs-puppet_conf', '0.6.0'
27
- mod 'puppetlabs-python_task_helper', '0.4.0'
27
+ mod 'puppetlabs-python_task_helper', '0.4.3'
28
28
  mod 'puppetlabs-reboot', '3.0.0'
29
29
  mod 'puppetlabs-ruby_task_helper', '0.5.1'
30
30
  mod 'puppetlabs-ruby_plugin_helper', '0.1.0'
@@ -17,5 +17,7 @@ Puppet::DataTypes.create_type('ApplyResult') do
17
17
 
18
18
  load_file('bolt/apply_result')
19
19
 
20
+ # Needed for Puppet to recognize Bolt::ApplyResult as a Puppet object when deserializing
21
+ Bolt::ApplyResult.include(Puppet::Pops::Types::PuppetObject)
20
22
  implementation_class Bolt::ApplyResult
21
23
  end
@@ -19,5 +19,7 @@ Puppet::DataTypes.create_type('Result') do
19
19
 
20
20
  load_file('bolt/result')
21
21
 
22
+ # Needed for Puppet to recognize Bolt::Result as a Puppet object when deserializing
23
+ Bolt::Result.include(Puppet::Pops::Types::PuppetObject)
22
24
  implementation_class Bolt::Result
23
25
  end
@@ -25,5 +25,7 @@ Puppet::DataTypes.create_type('ResultSet') do
25
25
 
26
26
  load_file('bolt/result_set')
27
27
 
28
+ # Needed for Puppet to recognize Bolt::ResultSet as a Puppet object when deserializing
29
+ Bolt::ResultSet.include(Puppet::Pops::Types::PuppetObject)
28
30
  implementation_class Bolt::ResultSet
29
31
  end
@@ -8,8 +8,6 @@ Puppet::DataTypes.create_type('Target') do
8
8
  target_implementation_class = Bolt::Target
9
9
  end
10
10
 
11
- require 'bolt/target'
12
-
13
11
  interface <<-PUPPET
14
12
  attributes => {
15
13
  uri => { type => Optional[String[1]], kind => given_or_derived },
@@ -34,5 +32,7 @@ Puppet::DataTypes.create_type('Target') do
34
32
  }
35
33
  PUPPET
36
34
 
35
+ # Needed for Puppet to recognize targets as Puppet objects when deserializing
36
+ target_implementation_class.include(Puppet::Pops::Types::PuppetObject)
37
37
  implementation_class target_implementation_class
38
38
  end
@@ -34,6 +34,8 @@ module Bolt
34
34
  search_dirs << mod.plugins if mod.plugins?
35
35
  search_dirs << mod.pluginfacts if mod.pluginfacts?
36
36
  search_dirs << mod.files if mod.files?
37
+ type_files = "#{mod.path}/types"
38
+ search_dirs << type_files if File.exist?(type_files)
37
39
  search_dirs
38
40
  end
39
41
  end
@@ -57,7 +57,7 @@ module Bolt
57
57
  msg = "Report result contains an '_output' key. Catalog application may have printed extraneous output to stdout: #{result['_output']}"
58
58
  # rubocop:enable Layout/LineLength
59
59
  else
60
- msg = "Report did not contain all expected keys missing: #{missing_keys.join(' ,')}"
60
+ msg = "Report did not contain all expected keys missing: #{missing_keys.join(', ')}"
61
61
  end
62
62
 
63
63
  { 'msg' => msg,
@@ -689,7 +689,7 @@ module Bolt
689
689
 
690
690
  separator "\nRUN CONTEXT OPTIONS"
691
691
  define('-c', '--concurrency CONCURRENCY', Integer,
692
- 'Maximum number of simultaneous connections (default: 100)') do |concurrency|
692
+ 'Maximum number of simultaneous connections') do |concurrency|
693
693
  @options[:concurrency] = concurrency
694
694
  end
695
695
  define('--compile-concurrency CONCURRENCY', Integer,
@@ -66,8 +66,8 @@ module Bolt
66
66
 
67
67
  DEFAULT_OPTIONS = {
68
68
  "color" => true,
69
- "concurrency" => 100,
70
69
  "compile-concurrency" => "Number of cores",
70
+ "concurrency" => "100 or one-third of the ulimit, whichever is lower",
71
71
  "format" => "human",
72
72
  "hiera-config" => "Boltdir/hiera.yaml",
73
73
  "inventoryfile" => "Boltdir/inventory.yaml",
@@ -103,6 +103,8 @@ module Bolt
103
103
  "show_diff" => false
104
104
  }.freeze
105
105
 
106
+ DEFAULT_DEFAULT_CONCURRENCY = 100
107
+
106
108
  def self.default
107
109
  new(Bolt::Project.new('.'), {})
108
110
  end
@@ -165,7 +167,7 @@ module Bolt
165
167
  'apply_settings' => {},
166
168
  'color' => true,
167
169
  'compile-concurrency' => Etc.nprocessors,
168
- 'concurrency' => 100,
170
+ 'concurrency' => default_concurrency,
169
171
  'format' => 'human',
170
172
  'log' => { 'console' => {} },
171
173
  'plugin_hooks' => {},
@@ -183,6 +185,18 @@ module Bolt
183
185
 
184
186
  override_data = normalize_overrides(overrides)
185
187
 
188
+ # If we need to lower concurrency and concurrency is not configured
189
+ ld_concurrency = loaded_data.map(&:keys).flatten.include?('concurrency')
190
+ if default_concurrency != DEFAULT_DEFAULT_CONCURRENCY &&
191
+ !ld_concurrency &&
192
+ !override_data.key?('concurrency')
193
+ concurrency_warning = { option: 'concurrency',
194
+ msg: "Concurrency will default to #{default_concurrency} because ulimit "\
195
+ "is low: #{Etc.sysconf(Etc::SC_OPEN_MAX)}. Set concurrency with "\
196
+ "'--concurrency', or set your ulimit with 'ulimit -n <limit>'" }
197
+ @warnings << concurrency_warning
198
+ end
199
+
186
200
  @data = merge_config_layers(default_data, *loaded_data, override_data)
187
201
 
188
202
  TRANSPORT_CONFIG.each do |transport, config|
@@ -458,5 +472,13 @@ module Bolt
458
472
  l =~ /[A-Za-z]/ ? "[#{l.upcase}#{l.downcase}]" : l
459
473
  end.join
460
474
  end
475
+
476
+ def default_concurrency
477
+ if Bolt::Util.windows? || Etc.sysconf(Etc::SC_OPEN_MAX) >= 300 || Etc.sysconf(Etc::SC_OPEN_MAX).nil?
478
+ DEFAULT_DEFAULT_CONCURRENCY
479
+ else
480
+ (Etc.sysconf(Etc::SC_OPEN_MAX) / 3).floor
481
+ end
482
+ end
461
483
  end
462
484
  end
@@ -353,9 +353,9 @@ module Bolt
353
353
  # Chunks of this size will be read in one iteration
354
354
  index = 0
355
355
  timeout = 0.1
356
+ result_output = Bolt::Node::Output.new
356
357
 
357
358
  inp, out, err, t = conn.execute(command_str)
358
- result_output = Bolt::Node::Output.new
359
359
  read_streams = { out => String.new,
360
360
  err => String.new }
361
361
  write_stream = in_buffer.empty? ? [] : [inp]
@@ -207,6 +207,10 @@ module Bolt
207
207
  err_wr.close
208
208
  end
209
209
  [in_wr, out_rd, err_rd, th]
210
+ rescue Errno::EMFILE => e
211
+ msg = "#{e.message}. This may be resolved by increasing your user limit "\
212
+ "with 'ulimit -n 1024'. See https://puppet.com/docs/bolt/latest/bolt_known_issues.html for details."
213
+ raise Bolt::Error.new(msg, 'bolt/too-many-files')
210
214
  end
211
215
 
212
216
  def copy_file(source, destination)
@@ -120,6 +120,10 @@ module Bolt
120
120
  end
121
121
 
122
122
  [inp, out_rd, err_rd, th]
123
+ rescue Errno::EMFILE => e
124
+ msg = "#{e.message}. This may be resolved by increasing your user limit "\
125
+ "with 'ulimit -n 1024'. See https://puppet.com/docs/bolt/latest/bolt_known_issues.html for details."
126
+ raise Bolt::Error.new(msg, 'bolt/too-many-files')
123
127
  rescue StandardError
124
128
  @logger.debug { "Command aborted" }
125
129
  raise
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bolt
4
- VERSION = '2.10.0'
4
+ VERSION = '2.11.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: 2.10.0
4
+ version: 2.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-18 00:00:00.000000000 Z
11
+ date: 2020-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable