bolt 2.40.2 → 2.42.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: d1b59f916303bbd38bb82a011ecff7a2e5086094586cea84d4cd78fb052d2171
4
- data.tar.gz: 425288bb47b49aa017d71ee0b2bb1e48de475980f70e14be11f369acadfd0582
3
+ metadata.gz: d520aad8f699a4a52849ac189a6368b799238996a0c4dae22e75f2abfbe43eff
4
+ data.tar.gz: befcf8835708c4ec4605e560dfd060680a6d680b7614bfd3d4d4baba7fb7cfa5
5
5
  SHA512:
6
- metadata.gz: dc56fc52b8e52553902316fb26204a89a90901a9cf56e13d9ff8a1f2d4aea96d1054d578bda7598ba38384baf424a751230038bd8c6c593b113854a176cafeb7
7
- data.tar.gz: 07a33c2ea3d3fdf5f69e9844d7c45dbb88cfedfabd8ce9264408876ee7496568033d372128eba510431bbb749c4223a8ba5420941936f2efd304ded398c90ad0
6
+ metadata.gz: 0f25f959178fe587c518723cdc1dffd7bd420ea1d943ff1dcfda410cffd0ad592d3cd5714f5d4707dc9a4aa6fec0eb3103382a0266bf56f0625c2c06bc325f98
7
+ data.tar.gz: 7b05c93e0f507429bd5c43d5a0d0ed51f42d8ac1c0621c1c125ac1905a193a09e6802bb898f90650f7b95d8b0a2c5c513adbf93b3626d109936a447dcfaaf3dd
data/Puppetfile CHANGED
@@ -5,14 +5,14 @@ forge "http://forge.puppetlabs.com"
5
5
  moduledir File.join(File.dirname(__FILE__), 'modules')
6
6
 
7
7
  # Core modules used by 'apply'
8
- mod 'puppetlabs-service', '1.3.0'
9
- mod 'puppetlabs-puppet_agent', '4.2.0'
10
- mod 'puppetlabs-facts', '1.2.0'
8
+ mod 'puppetlabs-service', '1.4.0'
9
+ mod 'puppetlabs-puppet_agent', '4.3.0'
10
+ mod 'puppetlabs-facts', '1.3.0'
11
11
 
12
12
  # Core types and providers for Puppet 6
13
13
  mod 'puppetlabs-augeas_core', '1.1.1'
14
14
  mod 'puppetlabs-host_core', '1.0.3'
15
- mod 'puppetlabs-scheduled_task', '2.2.1'
15
+ mod 'puppetlabs-scheduled_task', '2.3.1'
16
16
  mod 'puppetlabs-sshkeys_core', '2.2.0'
17
17
  mod 'puppetlabs-zfs_core', '1.2.0'
18
18
  mod 'puppetlabs-cron_core', '1.0.5'
@@ -22,10 +22,10 @@ mod 'puppetlabs-yumrepo_core', '1.0.7'
22
22
  mod 'puppetlabs-zone_core', '1.0.3'
23
23
 
24
24
  # Useful additional modules
25
- mod 'puppetlabs-package', '1.3.0'
26
- mod 'puppetlabs-puppet_conf', '0.6.0'
25
+ mod 'puppetlabs-package', '1.4.0'
26
+ mod 'puppetlabs-puppet_conf', '0.8.0'
27
27
  mod 'puppetlabs-python_task_helper', '0.4.3'
28
- mod 'puppetlabs-reboot', '3.0.0'
28
+ mod 'puppetlabs-reboot', '3.1.0'
29
29
  mod 'puppetlabs-ruby_task_helper', '0.5.1'
30
30
  mod 'puppetlabs-ruby_plugin_helper', '0.1.0'
31
31
  mod 'puppetlabs-stdlib', '6.5.0'
@@ -761,14 +761,6 @@ module Bolt
761
761
  return 0
762
762
  end
763
763
 
764
- if resolve != false && config.any?
765
- @logger.warn(
766
- "Detected configuration for 'module-install'. This configuration is currently "\
767
- "only supported when installing modules, not when resolving module dependencies. "\
768
- "For more information, see https://pup.pt/bolt-module-install"
769
- )
770
- end
771
-
772
764
  modules = project.modules || []
773
765
  installer = Bolt::ModuleInstaller.new(outputter, pal)
774
766
 
@@ -790,14 +782,6 @@ module Bolt
790
782
  assert_project_file(project)
791
783
  assert_puppetfile_or_module_command(project.modules)
792
784
 
793
- if config.any?
794
- @logger.warn(
795
- "Detected configuration for 'module-install'. This configuration is currently "\
796
- "only supported when installing modules, not when resolving module dependencies. "\
797
- "For more information, see https://pup.pt/bolt-module-install"
798
- )
799
- end
800
-
801
785
  modules = project.modules || []
802
786
  installer = Bolt::ModuleInstaller.new(outputter, pal)
803
787
 
@@ -874,6 +858,10 @@ module Bolt
874
858
  raise Bolt::CLIError,
875
859
  "Unable to use command '#{old_command}' when 'modules' is configured in "\
876
860
  "bolt-project.yaml. Use '#{new_command}' instead."
861
+ elsif modules.nil? && options[:subcommand] == 'puppetfile'
862
+ msg = "Command '#{old_command}' is deprecated and will be removed in Bolt 3.0. Update your project to use "\
863
+ "the module management feature. For more information, see https://pup.pt/bolt-module-migrate."
864
+ Bolt::Logger.deprecation_warning('puppetfile command', msg)
877
865
  elsif modules.nil? && options[:subcommand] == 'module'
878
866
  msg = "Unable to use command '#{new_command}' when 'modules' is not configured in "\
879
867
  "bolt-project.yaml. "
@@ -430,6 +430,8 @@ module Bolt
430
430
  _example: "https://my-proxy.com:8080"
431
431
  }
432
432
  },
433
+ _deprecation: "This option will be removed in Bolt 3.0. Update your project to use the module "\
434
+ "management feature. For more information, see https://pup.pt/bolt-module-migrate.",
433
435
  _plugin: false
434
436
  },
435
437
  "save-rerun" => {
@@ -55,7 +55,8 @@ module Bolt
55
55
  schema = {
56
56
  type: Hash,
57
57
  properties: OPTIONS.map { |opt| [opt, _ref: opt] }.to_h,
58
- definitions: DEFINITIONS
58
+ definitions: DEFINITIONS,
59
+ _plugin: true
59
60
  }
60
61
 
61
62
  schema[:definitions]['config'][:properties] = Bolt::Config.transport_definitions
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'bolt/config/options'
3
4
  require 'bolt/inventory/group'
4
5
  require 'bolt/inventory/inventory'
5
6
  require 'bolt/inventory/target'
@@ -18,12 +19,20 @@ module Bolt
18
19
  GROUP_KEYS = DATA_KEYS + %w[name groups targets]
19
20
  CONFIG_KEYS = Bolt::Config::INVENTORY_OPTIONS.keys
20
21
 
21
- def initialize(input, plugins)
22
+ def initialize(input, plugins, all_group: false)
22
23
  @logger = Bolt::Logger.logger(self)
23
24
  @plugins = plugins
24
25
 
25
26
  input = @plugins.resolve_top_level_references(input) if @plugins.reference?(input)
26
27
 
28
+ if all_group
29
+ if input.key?('name') && input['name'] != 'all'
30
+ @logger.warn("Top-level group '#{input['name']}' cannot specify a name, using 'all' instead.")
31
+ end
32
+
33
+ input = input.merge('name' => 'all')
34
+ end
35
+
27
36
  raise ValidationError.new("Group does not have a name", nil) unless input.key?('name')
28
37
 
29
38
  @name = @plugins.resolve_references(input['name'])
@@ -315,7 +324,26 @@ module Bolt
315
324
  'features' => @plugins.resolve_references(data.fetch('features', [])),
316
325
  'plugin_hooks' => @plugins.resolve_references(data.fetch('plugin_hooks', {}))
317
326
  }
327
+
318
328
  validate_data_keys(result, target)
329
+
330
+ Bolt::Config::Options::TRANSPORT_CONFIG.each_key do |transport|
331
+ next unless result['config'].key?(transport)
332
+ transport_config = result['config'][transport]
333
+ next unless transport_config.is_a?(Hash)
334
+ transport_config = Bolt::Util.postwalk_vals(transport_config) do |val|
335
+ if val.is_a?(Hash)
336
+ val = val.compact
337
+ val = nil if val.empty?
338
+ end
339
+ val
340
+ end
341
+ # the transport config is user-specified data so we
342
+ # still want to preserve it even if it exclusively
343
+ # contains nil-resolved keys
344
+ result['config'][transport] = transport_config || {}
345
+ end
346
+
319
347
  result['features'] = Set.new(result['features'].flatten)
320
348
  result
321
349
  end
@@ -21,7 +21,7 @@ module Bolt
21
21
  @transport = transport
22
22
  @config = transports
23
23
  @plugins = plugins
24
- @groups = Group.new(@data.merge('name' => 'all'), plugins)
24
+ @groups = Group.new(@data, plugins, all_group: true)
25
25
  @group_lookup = {}
26
26
  @targets = {}
27
27
 
@@ -6,8 +6,14 @@ module Bolt
6
6
  CONTENT_NAME_REGEX = /\A[a-z][a-z0-9_]*(::[a-z][a-z0-9_]*)*\z/.freeze
7
7
  MODULE_NAME_REGEX = /\A[a-z][a-z0-9_]*\z/.freeze
8
8
 
9
- def self.discover(modulepath)
10
- modulepath.each_with_object({}) do |path, mods|
9
+ def self.discover(modulepath, project)
10
+ mods = {}
11
+
12
+ if project.load_as_module?
13
+ mods[project.name] = Bolt::Module.new(project.name, project.path.to_s)
14
+ end
15
+
16
+ modulepath.each do |path|
11
17
  next unless File.exist?(path) && File.directory?(path)
12
18
  Dir.children(path)
13
19
  .map { |dir| File.join(path, dir) }
@@ -20,6 +26,8 @@ module Bolt
20
26
  end
21
27
  end
22
28
  end
29
+
30
+ mods
23
31
  end
24
32
 
25
33
  attr_reader :name, :path
@@ -9,7 +9,7 @@ module Bolt
9
9
  class Resolver
10
10
  # Resolves module specs and returns a Puppetfile object.
11
11
  #
12
- def resolve(specs, _config = {})
12
+ def resolve(specs, config = {})
13
13
  require 'puppetfile-resolver'
14
14
 
15
15
  # Build the document model from the specs.
@@ -38,10 +38,10 @@ module Bolt
38
38
  # raised by puppetfile-resolver and re-raising them as Bolt errors.
39
39
  begin
40
40
  result = resolver.resolve(
41
- cache: nil,
42
- ui: nil,
43
- module_paths: [],
44
- allow_missing_modules: false
41
+ cache: nil,
42
+ ui: nil,
43
+ allow_missing_modules: false,
44
+ spec_searcher_configuration: spec_searcher_config(config)
45
45
  )
46
46
  rescue StandardError => e
47
47
  raise Bolt::Error.new(e.message, 'bolt/module-resolver-error')
@@ -71,6 +71,14 @@ module Bolt
71
71
  # Create the Puppetfile object.
72
72
  Bolt::ModuleInstaller::Puppetfile.new(modules)
73
73
  end
74
+
75
+ private def spec_searcher_config(config)
76
+ PuppetfileResolver::SpecSearchers::Configuration.new.tap do |obj|
77
+ obj.forge.proxy = config.dig('forge', 'proxy') || config.dig('proxy')
78
+ obj.git.proxy = config.dig('proxy')
79
+ obj.forge.forge_api = config.dig('forge', 'baseurl')
80
+ end
81
+ end
74
82
  end
75
83
  end
76
84
  end
@@ -64,7 +64,11 @@ module Bolt
64
64
  raise Bolt::FileError.new(msg, @plan_path)
65
65
  end
66
66
 
67
- Bolt::PAL::YamlPlan::Loader.from_string(@modulename, file_contents, @plan_path)
67
+ begin
68
+ Bolt::PAL::YamlPlan::Loader.from_string(@modulename, file_contents, @plan_path)
69
+ rescue Puppet::PreformattedError, StandardError => e
70
+ raise PALError.from_preformatted_error(e)
71
+ end
68
72
  end
69
73
 
70
74
  def validate_path
@@ -170,7 +170,7 @@ module Bolt
170
170
  end
171
171
 
172
172
  def modules
173
- @modules ||= Bolt::Module.discover(@pal.full_modulepath)
173
+ @modules ||= Bolt::Module.discover(@pal.full_modulepath, @config.project)
174
174
  end
175
175
 
176
176
  def add_plugin(plugin)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bolt
4
- VERSION = '2.40.2'
4
+ VERSION = '2.42.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.40.2
4
+ version: 2.42.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-12-18 00:00:00.000000000 Z
11
+ date: 2021-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: ffi
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "<"
74
+ - !ruby/object:Gem::Version
75
+ version: 1.14.0
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "<"
81
+ - !ruby/object:Gem::Version
82
+ version: 1.14.0
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: hiera-eyaml
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -196,16 +210,16 @@ dependencies:
196
210
  name: puppetfile-resolver
197
211
  requirement: !ruby/object:Gem::Requirement
198
212
  requirements:
199
- - - '='
213
+ - - "~>"
200
214
  - !ruby/object:Gem::Version
201
- version: 0.4.0
215
+ version: '0.5'
202
216
  type: :runtime
203
217
  prerelease: false
204
218
  version_requirements: !ruby/object:Gem::Requirement
205
219
  requirements:
206
- - - '='
220
+ - - "~>"
207
221
  - !ruby/object:Gem::Version
208
- version: 0.4.0
222
+ version: '0.5'
209
223
  - !ruby/object:Gem::Dependency
210
224
  name: puppet-resource_api
211
225
  requirement: !ruby/object:Gem::Requirement
@@ -311,9 +325,6 @@ dependencies:
311
325
  - - ">="
312
326
  - !ruby/object:Gem::Version
313
327
  version: '1.14'
314
- - - "<"
315
- - !ruby/object:Gem::Version
316
- version: 2.2.0
317
328
  type: :development
318
329
  prerelease: false
319
330
  version_requirements: !ruby/object:Gem::Requirement
@@ -321,9 +332,6 @@ dependencies:
321
332
  - - ">="
322
333
  - !ruby/object:Gem::Version
323
334
  version: '1.14'
324
- - - "<"
325
- - !ruby/object:Gem::Version
326
- version: 2.2.0
327
335
  - !ruby/object:Gem::Dependency
328
336
  name: octokit
329
337
  requirement: !ruby/object:Gem::Requirement