bolt 2.38.0 → 2.40.1

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: 33e89c3fc601a61c1da47fe1f0c7773d54643738e959c297f34e5fe4096ef2b5
4
- data.tar.gz: 0edc4e35b500bb08315ef5d6064563d7dad0cbaecd88d3aac03dc4cf43572b33
3
+ metadata.gz: 7cdc44f8a923197b1dbb6a51f9dd524f0fe10f8ceb5acc9ca97dc62f7c4b37d5
4
+ data.tar.gz: d2be21d9601d415b808d1a5f282e31e048be914a71e21bba340be4caf4f8a896
5
5
  SHA512:
6
- metadata.gz: f2d3a5675a1560203dc0236cdd7b5a9367728b6b1decdfc85a99136488ab2ed1a10bc492996b2aa5b2681fdba8f2029f9e092a3011d8be4d5bfb2395358ffb6a
7
- data.tar.gz: 79b4418d6628573320b1db7740d8196ddb73f55d93f299a68a3c5f436c5986fc9382e48bd5d2e14903d18e3bf648b47493041a9ad0196983e1fb7a06ff9cf4bd
6
+ metadata.gz: d6ca1c1bfd4c6fd6b891d006040c13b0897a44ec9904511e7e57f9eb5b2fd0d85dd2bd1371b226f488595ae2847764591754d6db4b50eaf8328fd2aeecce7ebb
7
+ data.tar.gz: 077f5217b308db31a118dc21884b65b15112bb9b6922a468ea5658c803e1851df4520aabc71fcdeb4f982dfc7c09955629564b600c2fadcf2d14d4b7e24631f6
@@ -448,39 +448,14 @@ module Bolt
448
448
  next if val == 'disable'
449
449
 
450
450
  name = normalize_log(key)
451
+ acc[name] = val.slice('append', 'level').transform_keys(&:to_sym)
451
452
 
452
- # But otherwise it has to be a Hash
453
- unless val.is_a?(Hash)
454
- raise Bolt::ValidationError,
455
- "config of log #{name} must be a Hash, received #{val.class} #{val.inspect}"
456
- end
457
-
458
- acc[name] = val.slice('append', 'level')
459
- .transform_keys(&:to_sym)
460
-
461
- if (v = acc[name][:level])
462
- unless v.is_a?(String) || v.is_a?(Symbol)
463
- raise Bolt::ValidationError,
464
- "level of log #{name} must be a String or Symbol, received #{v.class} #{v.inspect}"
465
- end
466
-
467
- unless Bolt::Logger.valid_level?(v)
468
- raise Bolt::ValidationError,
469
- "level of log #{name} must be one of #{Bolt::Logger.levels.join(', ')}; received #{v}"
470
- end
453
+ next unless acc[name][:level] == 'notice'
471
454
 
472
- if v == 'notice'
473
- @deprecations << {
474
- type: 'notice log level',
475
- msg: "Log level 'notice' is deprecated and will be removed in Bolt 3.0. Use 'info' instead."
476
- }
477
- end
478
- end
479
-
480
- if (v = acc[name][:append]) && v != true && v != false
481
- raise Bolt::ValidationError,
482
- "append flag of log #{name} must be a Boolean, received #{v.class} #{v.inspect}"
483
- end
455
+ @deprecations << {
456
+ type: 'notice log level',
457
+ msg: "Log level 'notice' is deprecated and will be removed in Bolt 3.0. Use 'info' instead."
458
+ }
484
459
  end
485
460
  end
486
461
 
@@ -509,10 +484,6 @@ module Bolt
509
484
  Bolt::Util.validate_file('inventory file', default_inventoryfile)
510
485
  end
511
486
 
512
- unless TRANSPORT_CONFIG.include?(transport)
513
- raise UnknownTransportError, transport
514
- end
515
-
516
487
  # Warn the user how they should be using the 'puppetfile' or
517
488
  # 'module-install' config options. We don't error here since these
518
489
  # settings can be set at the user or system level.
@@ -509,6 +509,7 @@ module Bolt
509
509
  "remote" => {
510
510
  description: "A map of configuration options for the remote transport.",
511
511
  type: Hash,
512
+ additionalProperties: true,
512
513
  _plugin: true,
513
514
  _example: { "run-on" => "proxy_target" }
514
515
  },
@@ -143,7 +143,8 @@ module Bolt
143
143
  "`task.py`) and the extension is case sensitive. When a target's name is `localhost`, "\
144
144
  "Ruby tasks run with the Bolt Ruby interpreter by default.",
145
145
  additionalProperties: {
146
- type: String
146
+ type: String,
147
+ _plugin: false
147
148
  },
148
149
  propertyNames: {
149
150
  pattern: "^.?[a-zA-Z0-9]+$"
@@ -111,11 +111,6 @@ module Bolt
111
111
  @config['interpreters'] = normalize_interpreters(@config['interpreters'])
112
112
  end
113
113
 
114
- if @config['login-shell'] && !LOGIN_SHELLS.include?(@config['login-shell'])
115
- raise Bolt::ValidationError,
116
- "Unsupported login-shell #{@config['login-shell']}. Supported shells are #{LOGIN_SHELLS.join(', ')}"
117
- end
118
-
119
114
  if @config['login-shell'] == 'powershell'
120
115
  %w[tty run-as].each do |key|
121
116
  if @config[key]
@@ -254,14 +254,6 @@ module Bolt
254
254
  msg = "Found unexpected key(s) #{unexpected_keys.join(', ')} in group #{@name}"
255
255
  @logger.warn(msg)
256
256
  end
257
-
258
- Bolt::Util.walk_keys(input) do |key|
259
- if @plugins.reference?(key)
260
- raise ValidationError.new("Group keys cannot be specified as _plugin references", @name)
261
- else
262
- key
263
- end
264
- end
265
257
  end
266
258
 
267
259
  def validate(used_group_names = Set.new, used_target_names = Set.new, used_aliases = {})
@@ -21,7 +21,7 @@ module Bolt
21
21
 
22
22
  # Luckily we don't need to use a serious hash algorithm
23
23
  require 'digest/bubblebabble'
24
- r = reference.select { |k, _| k == '_cache' }.sort.to_s
24
+ r = reference.reject { |k, _| k == '_cache' }.sort.to_s
25
25
  @id = Digest::SHA2.bubblebabble(r)[0..20]
26
26
 
27
27
  unmodified = true
@@ -47,17 +47,18 @@ module Bolt
47
47
  # the value's type, the value is passed off to an individual
48
48
  # validation method for the value's type.
49
49
  #
50
- private def validate_value(value, definition)
51
- definition = @schema.dig(:definitions, definition[:_ref]) if definition[:_ref]
50
+ private def validate_value(value, definition, plugin_supported = false)
51
+ definition = @schema.dig(:definitions, definition[:_ref]) if definition[:_ref]
52
+ plugin_supported = definition[:_plugin] if definition.key?(:_plugin)
52
53
 
53
- return if plugin_reference?(value, definition)
54
+ return if plugin_reference?(value, plugin_supported)
54
55
  return unless valid_type?(value, definition)
55
56
 
56
57
  case value
57
58
  when Hash
58
- validate_hash(value, definition)
59
+ validate_hash(value, definition, plugin_supported)
59
60
  when Array
60
- validate_array(value, definition)
61
+ validate_array(value, definition, plugin_supported)
61
62
  when String
62
63
  validate_string(value, definition)
63
64
  when Numeric
@@ -69,7 +70,7 @@ module Bolt
69
70
  # This will enumerate each key-value pair in the hash and validate each
70
71
  # value individually.
71
72
  #
72
- private def validate_hash(value, definition)
73
+ private def validate_hash(value, definition, plugin_supported)
73
74
  properties = definition[:properties] ? definition[:properties].keys : []
74
75
 
75
76
  if definition[:properties] && definition[:additionalProperties].nil?
@@ -86,9 +87,9 @@ module Bolt
86
87
 
87
88
  if properties.include?(key)
88
89
  check_deprecated(key, definition[:properties][key])
89
- validate_value(val, definition[:properties][key])
90
- elsif definition[:additionalProperties]
91
- validate_value(val, definition[:additionalProperties])
90
+ validate_value(val, definition[:properties][key], plugin_supported)
91
+ elsif definition[:additionalProperties].is_a?(Hash)
92
+ validate_value(val, definition[:additionalProperties], plugin_supported)
92
93
  end
93
94
  ensure
94
95
  @path.pop
@@ -99,7 +100,7 @@ module Bolt
99
100
  # This will enumerate the items in the array and validate each item
100
101
  # individually.
101
102
  #
102
- private def validate_array(value, definition)
103
+ private def validate_array(value, definition, plugin_supported)
103
104
  if definition[:uniqueItems] && value.size != value.uniq.size
104
105
  @errors << "Value at '#{path}' must not include duplicate elements"
105
106
  return
@@ -109,7 +110,7 @@ module Bolt
109
110
 
110
111
  value.each_with_index do |item, index|
111
112
  @path.push(index)
112
- validate_value(item, definition[:items])
113
+ validate_value(item, definition[:items], plugin_supported)
113
114
  ensure
114
115
  @path.pop
115
116
  end
@@ -168,9 +169,9 @@ module Bolt
168
169
  # plugin reference but cannot be one according to the schema, then this will
169
170
  # log an error.
170
171
  #
171
- private def plugin_reference?(value, definition)
172
+ private def plugin_reference?(value, plugin_supported)
172
173
  if value.is_a?(Hash) && value.key?('_plugin')
173
- unless definition[:_plugin]
174
+ unless plugin_supported
174
175
  @errors << "Value at '#{path}' is a plugin reference, which is unsupported at "\
175
176
  "this location"
176
177
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bolt
4
- VERSION = '2.38.0'
4
+ VERSION = '2.40.1'
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.38.0
4
+ version: 2.40.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-14 00:00:00.000000000 Z
11
+ date: 2020-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -626,7 +626,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
626
626
  - !ruby/object:Gem::Version
627
627
  version: '0'
628
628
  requirements: []
629
- rubygems_version: 3.0.8
629
+ rubygems_version: 3.0.3
630
630
  signing_key:
631
631
  specification_version: 4
632
632
  summary: Execute commands remotely over SSH and WinRM