bolt 3.16.0 → 3.19.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.

Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/Puppetfile +15 -15
  3. data/bolt-modules/boltlib/lib/puppet/functions/run_script.rb +1 -4
  4. data/bolt-modules/boltlib/lib/puppet/functions/upload_file.rb +1 -4
  5. data/bolt-modules/file/lib/puppet/functions/file/exists.rb +1 -4
  6. data/bolt-modules/file/lib/puppet/functions/file/read.rb +1 -4
  7. data/bolt-modules/file/lib/puppet/functions/file/readable.rb +1 -4
  8. data/lib/bolt/analytics.rb +2 -2
  9. data/lib/bolt/application.rb +24 -17
  10. data/lib/bolt/applicator.rb +7 -6
  11. data/lib/bolt/apply_inventory.rb +3 -3
  12. data/lib/bolt/apply_result.rb +2 -2
  13. data/lib/bolt/bolt_option_parser.rb +15 -0
  14. data/lib/bolt/catalog.rb +10 -11
  15. data/lib/bolt/cli.rb +20 -22
  16. data/lib/bolt/config/modulepath.rb +1 -1
  17. data/lib/bolt/config/options.rb +32 -13
  18. data/lib/bolt/config/transport/base.rb +4 -4
  19. data/lib/bolt/config/transport/docker.rb +2 -2
  20. data/lib/bolt/config/transport/local.rb +2 -2
  21. data/lib/bolt/config/transport/lxd.rb +2 -2
  22. data/lib/bolt/config/transport/orch.rb +2 -2
  23. data/lib/bolt/config/transport/podman.rb +2 -2
  24. data/lib/bolt/config/transport/remote.rb +2 -2
  25. data/lib/bolt/config/transport/ssh.rb +2 -2
  26. data/lib/bolt/config/transport/winrm.rb +2 -2
  27. data/lib/bolt/config.rb +5 -5
  28. data/lib/bolt/container_result.rb +2 -2
  29. data/lib/bolt/error.rb +1 -1
  30. data/lib/bolt/executor.rb +17 -14
  31. data/lib/bolt/fiber_executor.rb +2 -2
  32. data/lib/bolt/inventory/group.rb +4 -4
  33. data/lib/bolt/inventory/inventory.rb +64 -41
  34. data/lib/bolt/inventory/options.rb +1 -1
  35. data/lib/bolt/inventory/target.rb +1 -1
  36. data/lib/bolt/inventory.rb +10 -17
  37. data/lib/bolt/module_installer/installer.rb +2 -2
  38. data/lib/bolt/module_installer/puppetfile/forge_module.rb +1 -1
  39. data/lib/bolt/module_installer/puppetfile/git_module.rb +1 -1
  40. data/lib/bolt/module_installer/puppetfile/module.rb +1 -1
  41. data/lib/bolt/module_installer/puppetfile.rb +27 -13
  42. data/lib/bolt/module_installer/resolver.rb +3 -3
  43. data/lib/bolt/module_installer/specs/forge_spec.rb +1 -1
  44. data/lib/bolt/module_installer/specs/git_spec.rb +1 -1
  45. data/lib/bolt/module_installer/specs.rb +3 -3
  46. data/lib/bolt/module_installer.rb +6 -6
  47. data/lib/bolt/node/errors.rb +1 -1
  48. data/lib/bolt/node/output.rb +1 -1
  49. data/lib/bolt/outputter/human.rb +2 -2
  50. data/lib/bolt/outputter/logger.rb +1 -1
  51. data/lib/bolt/outputter/rainbow.rb +1 -1
  52. data/lib/bolt/outputter.rb +4 -4
  53. data/lib/bolt/pal/logging.rb +1 -1
  54. data/lib/bolt/pal/yaml_plan/evaluator.rb +1 -1
  55. data/lib/bolt/pal/yaml_plan/loader.rb +2 -2
  56. data/lib/bolt/pal/yaml_plan/step.rb +11 -11
  57. data/lib/bolt/pal/yaml_plan/transpiler.rb +3 -3
  58. data/lib/bolt/pal/yaml_plan.rb +2 -2
  59. data/lib/bolt/pal.rb +11 -11
  60. data/lib/bolt/plan_creator.rb +87 -10
  61. data/lib/bolt/plan_result.rb +2 -2
  62. data/lib/bolt/plugin/cache.rb +2 -2
  63. data/lib/bolt/plugin/module.rb +1 -1
  64. data/lib/bolt/plugin.rb +18 -24
  65. data/lib/bolt/project.rb +4 -4
  66. data/lib/bolt/project_manager/config_migrator.rb +1 -1
  67. data/lib/bolt/project_manager/inventory_migrator.rb +1 -1
  68. data/lib/bolt/project_manager/migrator.rb +1 -1
  69. data/lib/bolt/project_manager/module_migrator.rb +5 -5
  70. data/lib/bolt/project_manager.rb +23 -4
  71. data/lib/bolt/puppetdb/config.rb +1 -1
  72. data/lib/bolt/puppetdb.rb +3 -3
  73. data/lib/bolt/result.rb +1 -1
  74. data/lib/bolt/shell/bash.rb +12 -2
  75. data/lib/bolt/shell/powershell.rb +9 -2
  76. data/lib/bolt/shell.rb +2 -2
  77. data/lib/bolt/target.rb +2 -2
  78. data/lib/bolt/transport/base.rb +1 -1
  79. data/lib/bolt/transport/docker/connection.rb +1 -1
  80. data/lib/bolt/transport/docker.rb +2 -2
  81. data/lib/bolt/transport/local/connection.rb +2 -2
  82. data/lib/bolt/transport/local.rb +3 -3
  83. data/lib/bolt/transport/lxd/connection.rb +1 -1
  84. data/lib/bolt/transport/lxd.rb +4 -4
  85. data/lib/bolt/transport/orch.rb +2 -2
  86. data/lib/bolt/transport/podman/connection.rb +1 -1
  87. data/lib/bolt/transport/podman.rb +2 -2
  88. data/lib/bolt/transport/remote.rb +2 -2
  89. data/lib/bolt/transport/simple.rb +3 -3
  90. data/lib/bolt/transport/ssh/connection.rb +3 -3
  91. data/lib/bolt/transport/ssh.rb +5 -5
  92. data/lib/bolt/transport/winrm/connection.rb +2 -2
  93. data/lib/bolt/transport/winrm.rb +3 -3
  94. data/lib/bolt/util.rb +8 -31
  95. data/lib/bolt/validator.rb +1 -1
  96. data/lib/bolt/version.rb +1 -1
  97. data/lib/bolt.rb +1 -1
  98. data/lib/bolt_server/file_cache.rb +12 -0
  99. data/lib/bolt_server/schemas/action-apply.json +32 -0
  100. data/lib/bolt_server/schemas/action-apply_prep.json +19 -0
  101. data/lib/bolt_server/transport_app.rb +139 -29
  102. data/lib/bolt_spec/bolt_context.rb +7 -5
  103. data/lib/bolt_spec/plans/mock_executor.rb +3 -3
  104. data/lib/bolt_spec/run.rb +1 -1
  105. data/libexec/bolt_catalog +1 -1
  106. metadata +6 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7d61e436c7358897d1769da6db2544c2e5b3e23310bd5a6663d2b35e2afc1ab5
4
- data.tar.gz: 1322c9a80154199cb658cf7807a88a96448b3b197ec5576ddaeabf76da52c29f
3
+ metadata.gz: f615bd259875c82b953db516b48975c66863ef4f4002a4f55317f9f867a0cf6c
4
+ data.tar.gz: 0027a9463d88e77455c7a83e5716f3097d921a32f172b931530b5f58827f427e
5
5
  SHA512:
6
- metadata.gz: 57bddbbc4d2cb78cb2aa6964e3ecff5a61c95c88e5f6b7524bbbc5b5ce3ca070098aae37d2ebb2ba3fcb569e3a082bf9ec4ebff2013bae31fc65eedadbde4b6c
7
- data.tar.gz: 2c64c1607a21cdebe49550ad8207201fe853478c9f18cb4af04826410ddf507f8c505fbae5340faa64c070910e3f9e86372d4ae1de4b6108fad4eb95fc454316
6
+ metadata.gz: 8c0d779b31ff416f05d625ba4effb197a7b453f02e19489220e228c3e35b20abf3bc04e85f09562faf8e0b12b415f20c8e6facfcded1d09212f45df2d2d73690
7
+ data.tar.gz: d5ed05307adf5ff3c71d6db4a076b972284259aa837945eaf389d71434d795f90bb95efb783006fee32076b6311c8b4baad11627511cfad9957fa60f726de937
data/Puppetfile CHANGED
@@ -5,37 +5,37 @@ 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', '2.0.0'
9
- mod 'puppetlabs-puppet_agent', '4.8.0'
8
+ mod 'puppetlabs-service', '2.1.0'
9
+ mod 'puppetlabs-puppet_agent', '4.9.0'
10
10
  mod 'puppetlabs-facts', '1.4.0'
11
11
 
12
12
  # Core types and providers for Puppet 6
13
- mod 'puppetlabs-augeas_core', '1.1.2'
14
- mod 'puppetlabs-host_core', '1.0.3'
13
+ mod 'puppetlabs-augeas_core', '1.2.0'
14
+ mod 'puppetlabs-host_core', '1.1.0'
15
15
  mod 'puppetlabs-scheduled_task', '3.0.1'
16
- mod 'puppetlabs-sshkeys_core', '2.2.0'
17
- mod 'puppetlabs-zfs_core', '1.2.0'
18
- mod 'puppetlabs-cron_core', '1.0.5'
19
- mod 'puppetlabs-mount_core', '1.0.4'
20
- mod 'puppetlabs-selinux_core', '1.1.0'
21
- mod 'puppetlabs-yumrepo_core', '1.0.7'
16
+ mod 'puppetlabs-sshkeys_core', '2.3.0'
17
+ mod 'puppetlabs-zfs_core', '1.3.0'
18
+ mod 'puppetlabs-cron_core', '1.1.0'
19
+ mod 'puppetlabs-mount_core', '1.1.0'
20
+ mod 'puppetlabs-selinux_core', '1.2.0'
21
+ mod 'puppetlabs-yumrepo_core', '1.1.0'
22
22
  mod 'puppetlabs-zone_core', '1.0.3'
23
23
 
24
24
  # Useful additional modules
25
- mod 'puppetlabs-package', '2.0.0'
25
+ mod 'puppetlabs-package', '2.1.0'
26
26
  mod 'puppetlabs-powershell_task_helper', '0.1.0'
27
- mod 'puppetlabs-puppet_conf', '1.1.0'
27
+ mod 'puppetlabs-puppet_conf', '1.2.0'
28
28
  mod 'puppetlabs-python_task_helper', '0.5.0'
29
- mod 'puppetlabs-reboot', '4.0.2'
29
+ mod 'puppetlabs-reboot', '4.1.0'
30
30
  mod 'puppetlabs-ruby_task_helper', '0.6.0'
31
31
  mod 'puppetlabs-ruby_plugin_helper', '0.2.0'
32
- mod 'puppetlabs-stdlib', '7.1.0'
32
+ mod 'puppetlabs-stdlib', '8.1.0'
33
33
 
34
34
  # Plugin modules
35
35
  mod 'puppetlabs-aws_inventory', '0.7.0'
36
36
  mod 'puppetlabs-azure_inventory', '0.5.0'
37
37
  mod 'puppetlabs-gcloud_inventory', '0.3.0'
38
- mod 'puppetlabs-http_request', '0.3.0'
38
+ mod 'puppetlabs-http_request', '0.3.1'
39
39
  mod 'puppetlabs-pkcs7', '0.1.2'
40
40
  mod 'puppetlabs-secure_env_vars', '0.2.0'
41
41
  mod 'puppetlabs-terraform', '0.6.1'
@@ -108,11 +108,8 @@ Puppet::Functions.create_function(:run_script, Puppet::Functions::InternalFuncti
108
108
  # Send Analytics Report
109
109
  executor.report_function_call(self.class.name)
110
110
 
111
- future = executor&.future || {}
112
- fallback = future.fetch('file_paths', false)
113
-
114
111
  # Find the file path if it exists, otherwise return nil
115
- found = Bolt::Util.find_file_from_scope(script, scope, fallback)
112
+ found = Bolt::Util.find_file_from_scope(script, scope)
116
113
  unless found && Puppet::FileSystem.exist?(found)
117
114
  raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
118
115
  Puppet::Pops::Issues::NO_SUCH_FILE_OR_DIRECTORY, file: script
@@ -70,11 +70,8 @@ Puppet::Functions.create_function(:upload_file, Puppet::Functions::InternalFunct
70
70
  # Send Analytics Report
71
71
  executor.report_function_call(self.class.name)
72
72
 
73
- future = executor&.future || {}
74
- fallback = future.fetch('file_paths', false)
75
-
76
73
  # Find the file path if it exists, otherwise return nil
77
- found = Bolt::Util.find_file_from_scope(source, scope, fallback)
74
+ found = Bolt::Util.find_file_from_scope(source, scope)
78
75
  unless found && Puppet::FileSystem.exist?(found)
79
76
  raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
80
77
  Puppet::Pops::Issues::NO_SUCH_FILE_OR_DIRECTORY, file: source
@@ -21,11 +21,8 @@ Puppet::Functions.create_function(:'file::exists', Puppet::Functions::InternalFu
21
21
  executor = Puppet.lookup(:bolt_executor) {}
22
22
  executor&.report_function_call(self.class.name)
23
23
 
24
- future = executor&.future || Puppet.lookup(:future) { {} }
25
- fallback = future.fetch('file_paths', false)
26
-
27
24
  # Find the file path if it exists, otherwise return nil
28
- found = Bolt::Util.find_file_from_scope(filename, scope, fallback)
25
+ found = Bolt::Util.find_file_from_scope(filename, scope)
29
26
  found ? Puppet::FileSystem.exist?(found) : false
30
27
  end
31
28
  end
@@ -20,11 +20,8 @@ Puppet::Functions.create_function(:'file::read', Puppet::Functions::InternalFunc
20
20
  executor = Puppet.lookup(:bolt_executor) {}
21
21
  executor&.report_function_call(self.class.name)
22
22
 
23
- future = executor&.future || Puppet.lookup(:future) { {} }
24
- fallback = future.fetch('file_paths', false)
25
-
26
23
  # Find the file path if it exists, otherwise return nil
27
- found = Bolt::Util.find_file_from_scope(filename, scope, fallback)
24
+ found = Bolt::Util.find_file_from_scope(filename, scope)
28
25
  unless found && Puppet::FileSystem.exist?(found)
29
26
  raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
30
27
  Puppet::Pops::Issues::NO_SUCH_FILE_OR_DIRECTORY, file: filename
@@ -21,11 +21,8 @@ Puppet::Functions.create_function(:'file::readable', Puppet::Functions::Internal
21
21
  executor = Puppet.lookup(:bolt_executor) {}
22
22
  executor&.report_function_call(self.class.name)
23
23
 
24
- future = executor&.future || Puppet.lookup(:future) { {} }
25
- fallback = future.fetch('file_paths', false)
26
-
27
24
  # Find the file path if it exists, otherwise return nil
28
- found = Bolt::Util.find_file_from_scope(filename, scope, fallback)
25
+ found = Bolt::Util.find_file_from_scope(filename, scope)
29
26
  found ? File.readable?(found) : false
30
27
  end
31
28
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/util'
4
- require 'bolt/version'
3
+ require_relative '../bolt/util'
4
+ require_relative '../bolt/version'
5
5
  require 'find'
6
6
  require 'json'
7
7
  require 'logging'
@@ -2,7 +2,8 @@
2
2
 
3
3
  require 'benchmark'
4
4
 
5
- require 'bolt/util'
5
+ require_relative '../bolt/plan_creator'
6
+ require_relative '../bolt/util'
6
7
 
7
8
  module Bolt
8
9
  class Application
@@ -88,7 +89,7 @@ module Bolt
88
89
  # @param env_vars [Hash] Environment variables to set on the target.
89
90
  # @return [Bolt::ResultSet]
90
91
  #
91
- def run_command(command, targets, env_vars: {})
92
+ def run_command(command, targets, env_vars: nil)
92
93
  targets = inventory.get_targets(targets)
93
94
 
94
95
  with_benchmark do
@@ -120,8 +121,7 @@ module Bolt
120
121
  # @return [Bolt::ResultSet]
121
122
  #
122
123
  def upload_file(source, destination, targets)
123
- future = executor.future&.fetch('file_paths', false)
124
- source = find_file(source, future)
124
+ source = find_file(source)
125
125
  targets = inventory.get_targets(targets)
126
126
 
127
127
  Bolt::Util.validate_file('source file', source, true)
@@ -258,7 +258,7 @@ module Bolt
258
258
  config.project.puppetfile,
259
259
  config.project.managed_moduledir,
260
260
  config.project.project_file,
261
- config.module_install)
261
+ @plugins.resolve_references(config.module_install))
262
262
  end
263
263
 
264
264
  # Generate Puppet data types from project modules.
@@ -292,7 +292,7 @@ module Bolt
292
292
  installer.install(config.project.modules,
293
293
  config.project.puppetfile,
294
294
  config.project.managed_moduledir,
295
- config.module_install,
295
+ @plugins.resolve_references(config.module_install),
296
296
  force: force,
297
297
  resolve: resolve)
298
298
  end
@@ -327,11 +327,20 @@ module Bolt
327
327
  #
328
328
  # @param name [String] The name of the new plan.
329
329
  # @param puppet [Boolean] Create a Puppet language plan.
330
+ # @param plan_script [String] Reference to the script to run in the new plan.
330
331
  # @return [Boolean]
331
332
  #
332
- def new_plan(name, puppet: false)
333
- Bolt::PlanCreator.validate_input(config.project, name)
334
- Bolt::PlanCreator.create_plan(config.project.plans_path, name, puppet)
333
+ def new_plan(name, puppet: false, plan_script: nil)
334
+ Bolt::PlanCreator.validate_plan_name(config.project, name)
335
+
336
+ if plan_script
337
+ Bolt::Util.validate_file('script', find_file(plan_script))
338
+ end
339
+
340
+ Bolt::PlanCreator.create_plan(config.project.plans_path,
341
+ name,
342
+ is_puppet: puppet,
343
+ script: plan_script)
335
344
  end
336
345
 
337
346
  # Run a plan.
@@ -433,9 +442,8 @@ module Bolt
433
442
  # @param env_vars [Hash] Environment variables to set on the target.
434
443
  # @return [Bolt::ResultSet]
435
444
  #
436
- def run_script(script, targets, arguments: [], env_vars: {})
437
- future = executor.future&.fetch('file_paths', false)
438
- script = find_file(script, future)
445
+ def run_script(script, targets, arguments: [], env_vars: nil)
446
+ script = find_file(script)
439
447
 
440
448
  Bolt::Util.validate_file('script', script)
441
449
 
@@ -555,18 +563,17 @@ module Bolt
555
563
  # directory.
556
564
  #
557
565
  # @param path [String] The path to the file.
558
- # @param future_file_paths [Boolean] Whether to use future file path behavior.
559
566
  #
560
- private def find_file(path, future_file_paths)
567
+ private def find_file(path)
561
568
  return path if File.exist?(path) || Pathname.new(path).absolute?
562
569
  modulepath = Bolt::Config::Modulepath.new(config.modulepath)
563
570
  modules = Bolt::Module.discover(modulepath.full_modulepath, config.project)
564
- mod, file = path.split(File::SEPARATOR, 2)
571
+ mod, file = path.split(File::SEPARATOR, 2)
565
572
 
566
573
  if modules[mod]
567
574
  logger.debug("Did not find file at #{File.expand_path(path)}, checking in module '#{mod}'")
568
- found = Bolt::Util.find_file_in_module(modules[mod].path, file || "", future_file_paths)
569
- path = found.nil? ? File.join(modules[mod].path, 'files', file) : found
575
+ found = Bolt::Util.find_file_in_module(modules[mod].path, file || "")
576
+ path = found.nil? ? File.join(modules[mod].path, 'files', file) : found
570
577
  end
571
578
 
572
579
  path
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'base64'
4
- require 'bolt/apply_result'
5
- require 'bolt/apply_target'
6
- require 'bolt/config'
7
- require 'bolt/error'
8
- require 'bolt/task'
9
- require 'bolt/util/puppet_log_level'
4
+ require_relative '../bolt/apply_result'
5
+ require_relative '../bolt/apply_target'
6
+ require_relative '../bolt/config'
7
+ require_relative '../bolt/error'
8
+ require_relative '../bolt/task'
9
+ require_relative '../bolt/util/puppet_log_level'
10
10
  require 'find'
11
11
  require 'json'
12
12
  require 'logging'
@@ -239,6 +239,7 @@ module Bolt
239
239
  search_dirs << mod.plugins if mod.plugins?
240
240
  search_dirs << mod.pluginfacts if mod.pluginfacts?
241
241
  search_dirs << mod.files if mod.files?
242
+ search_dirs << mod.scripts if mod.scripts?
242
243
  type_files = "#{mod.path}/types"
243
244
  search_dirs << type_files if File.exist?(type_files)
244
245
  search_dirs
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/project'
4
- require 'bolt/config'
5
- require 'bolt/error'
3
+ require_relative '../bolt/project'
4
+ require_relative '../bolt/config'
5
+ require_relative '../bolt/error'
6
6
 
7
7
  module Bolt
8
8
  class ApplyInventory
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'json'
4
- require 'bolt/error'
5
- require 'bolt/result'
4
+ require_relative '../bolt/error'
5
+ require_relative '../bolt/result'
6
6
 
7
7
  module Bolt
8
8
  class ApplyResult < Result
@@ -1042,6 +1042,21 @@ module Bolt
1042
1042
  define('--pp', 'Create a new Puppet language plan.') do |_|
1043
1043
  @options[:puppet] = true
1044
1044
  end
1045
+ define('--script SCRIPT', 'Create a new plan that wraps a script.') do |path|
1046
+ # If the path is a relative, absolute, or not a scripts path, raise an
1047
+ # error. This flag is intended to be used to create shareable plans.
1048
+ #
1049
+ # This also limits valid mounts to files and scripts, which we may want
1050
+ # to expand in the future.
1051
+ if File.exist?(path) || Pathname.new(path).absolute? ||
1052
+ !%w[scripts files].include?(path.split(File::SEPARATOR)[1])
1053
+ raise Bolt::CLIError, "The script must be a detailed Puppet file reference, " \
1054
+ "for example 'mymodule/scripts/myscript.sh'. See http://pup.pt/bolt-scripts for " \
1055
+ "more information on detailed Puppet file references."
1056
+ end
1057
+
1058
+ @options[:plan_script] = path
1059
+ end
1045
1060
 
1046
1061
  separator "\n#{self.class.colorize(:cyan, 'Display options')}"
1047
1062
  define('--filter FILTER', 'Filter tasks and plans by a matching substring.') do |filter|
data/lib/bolt/catalog.rb CHANGED
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/apply_inventory'
4
- require 'bolt/apply_target'
5
- require 'bolt/config'
6
- require 'bolt/error'
7
- require 'bolt/inventory'
8
- require 'bolt/pal'
9
- require 'bolt/puppetdb'
10
- require 'bolt/util'
3
+ require_relative '../bolt/apply_inventory'
4
+ require_relative '../bolt/apply_target'
5
+ require_relative '../bolt/config'
6
+ require_relative '../bolt/error'
7
+ require_relative '../bolt/inventory'
8
+ require_relative '../bolt/pal'
9
+ require_relative '../bolt/puppetdb'
10
+ require_relative '../bolt/util'
11
11
 
12
12
  Bolt::PAL.load_puppet
13
13
 
14
- require 'bolt/catalog/logging'
14
+ require_relative 'catalog/logging'
15
15
 
16
16
  module Bolt
17
17
  class Catalog
@@ -65,8 +65,7 @@ module Bolt
65
65
  puppet_overrides = {
66
66
  bolt_pdb_client: pdb_client,
67
67
  bolt_inventory: inv,
68
- bolt_project: bolt_project,
69
- future: request['future']
68
+ bolt_project: bolt_project
70
69
  }
71
70
 
72
71
  # Facts will be set by the catalog compiler, so we need to ensure
data/lib/bolt/cli.rb CHANGED
@@ -9,24 +9,23 @@ require 'json'
9
9
  require 'io/console'
10
10
  require 'logging'
11
11
  require 'optparse'
12
- require 'bolt/analytics'
13
- require 'bolt/application'
14
- require 'bolt/bolt_option_parser'
15
- require 'bolt/config'
16
- require 'bolt/error'
17
- require 'bolt/executor'
18
- require 'bolt/inventory'
19
- require 'bolt/logger'
20
- require 'bolt/module_installer'
21
- require 'bolt/outputter'
22
- require 'bolt/pal'
23
- require 'bolt/plan_creator'
24
- require 'bolt/plugin'
25
- require 'bolt/project_manager'
26
- require 'bolt/puppetdb'
27
- require 'bolt/rerun'
28
- require 'bolt/target'
29
- require 'bolt/version'
12
+ require_relative '../bolt/analytics'
13
+ require_relative '../bolt/application'
14
+ require_relative '../bolt/bolt_option_parser'
15
+ require_relative '../bolt/config'
16
+ require_relative '../bolt/error'
17
+ require_relative '../bolt/executor'
18
+ require_relative '../bolt/inventory'
19
+ require_relative '../bolt/logger'
20
+ require_relative '../bolt/module_installer'
21
+ require_relative '../bolt/outputter'
22
+ require_relative '../bolt/pal'
23
+ require_relative '../bolt/plugin'
24
+ require_relative '../bolt/project_manager'
25
+ require_relative '../bolt/puppetdb'
26
+ require_relative '../bolt/rerun'
27
+ require_relative '../bolt/target'
28
+ require_relative '../bolt/version'
30
29
 
31
30
  module Bolt
32
31
  class CLIExit < StandardError; end
@@ -54,8 +53,7 @@ module Bolt
54
53
  TARGETING_OPTIONS = %i[query rerun targets].freeze
55
54
 
56
55
  SUCCESS = 0
57
- ERROR = 1
58
- FAILURE = 2
56
+ FAILURE = 1
59
57
 
60
58
  def initialize(argv)
61
59
  Bolt::Logger.initialize_logging
@@ -435,7 +433,7 @@ module Bolt
435
433
  config.project
436
434
  )
437
435
 
438
- plugins = Bolt::Plugin.setup(config, pal, analytics)
436
+ plugins = Bolt::Plugin.new(config, pal, analytics)
439
437
 
440
438
  inventory = Bolt::Inventory.from_config(config, plugins)
441
439
 
@@ -611,7 +609,7 @@ module Bolt
611
609
  app.convert_plan(options[:object])
612
610
  SUCCESS
613
611
  when 'new'
614
- result = app.new_plan(options[:object], **options.slice(:puppet))
612
+ result = app.new_plan(options[:object], **options.slice(:puppet, :plan_script))
615
613
  outputter.print_new_plan(**result)
616
614
  SUCCESS
617
615
  when 'run'
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/config'
3
+ require_relative '../../bolt/config'
4
4
 
5
5
  module Bolt
6
6
  class Config
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/config/transport/docker'
4
- require 'bolt/config/transport/local'
5
- require 'bolt/config/transport/lxd'
6
- require 'bolt/config/transport/orch'
7
- require 'bolt/config/transport/podman'
8
- require 'bolt/config/transport/remote'
9
- require 'bolt/config/transport/ssh'
10
- require 'bolt/config/transport/winrm'
3
+ require_relative '../../bolt/config/transport/docker'
4
+ require_relative '../../bolt/config/transport/local'
5
+ require_relative '../../bolt/config/transport/lxd'
6
+ require_relative '../../bolt/config/transport/orch'
7
+ require_relative '../../bolt/config/transport/podman'
8
+ require_relative '../../bolt/config/transport/remote'
9
+ require_relative '../../bolt/config/transport/ssh'
10
+ require_relative '../../bolt/config/transport/winrm'
11
11
 
12
12
  module Bolt
13
13
  class Config
@@ -147,14 +147,23 @@ module Bolt
147
147
  type: Hash,
148
148
  properties: {
149
149
  "file_paths" => {
150
- description: "Load scripts from the `scripts/` directory of a module",
150
+ description: "Load scripts from the `scripts/` directory of a module.",
151
+ type: [TrueClass, FalseClass],
152
+ _example: true,
153
+ _default: false,
154
+ _deprecation: "Bolt no longer honors this option and enables loading scripts from the scripts "\
155
+ "directory by default."
156
+ },
157
+ "script_interpreter" => {
158
+ description: "Use a target's [`interpreters` configuration](bolt_transports_reference.md#interpreters) "\
159
+ "when running a script.",
151
160
  type: [TrueClass, FalseClass],
152
161
  _example: true,
153
162
  _default: false
154
163
  }
155
164
  },
156
165
  _plugin: false,
157
- _example: { 'file_paths' => true }
166
+ _example: { 'script_interpreter' => true }
158
167
  },
159
168
  "hiera-config" => {
160
169
  description: "The path to the Hiera configuration file.",
@@ -248,10 +257,16 @@ module Bolt
248
257
  type: Hash,
249
258
  properties: {
250
259
  "forge" => {
251
- description: "A subsection that can have its own `proxy` setting to set an HTTP proxy for Forge "\
252
- "operations only, and a `baseurl` setting to specify a different Forge host.",
260
+ description: "A subsection for configuring connections to a Forge host.",
253
261
  type: Hash,
254
262
  properties: {
263
+ "authorization_token" => {
264
+ description: "The token used to authorize requests to the Forge host. Must also specify "\
265
+ "`baseurl` when using this option.",
266
+ type: String,
267
+ _example: "Bearer eyJhbGciOiJIUzI1NiIsInR5c...",
268
+ _plugin: true
269
+ },
255
270
  "baseurl" => {
256
271
  description: "The URL to the Forge host.",
257
272
  type: String,
@@ -265,7 +280,11 @@ module Bolt
265
280
  _example: "https://my-forge-proxy.com:8080"
266
281
  }
267
282
  },
268
- _example: { "baseurl" => "https://forge.example.com", "proxy" => "https://my-forge-proxy.com:8080" }
283
+ _example: {
284
+ "authorization_token" => "Bearer eyJhbGciOiJIUzI1NiIsInR5c...",
285
+ "baseurl" => "https://forge.example.com",
286
+ "proxy" => "https://my-forge-proxy.com:8080"
287
+ }
269
288
  },
270
289
  "proxy" => {
271
290
  description: "The HTTP proxy to use for Git and Forge operations.",
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
4
- require 'bolt/util'
5
- require 'bolt/validator'
6
- require 'bolt/config/transport/options'
3
+ require_relative '../../../bolt/error'
4
+ require_relative '../../../bolt/util'
5
+ require_relative '../../../bolt/validator'
6
+ require_relative '../../../bolt/config/transport/options'
7
7
 
8
8
  module Bolt
9
9
  class Config
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
4
- require 'bolt/config/transport/base'
3
+ require_relative '../../../bolt/error'
4
+ require_relative '../../../bolt/config/transport/base'
5
5
 
6
6
  module Bolt
7
7
  class Config
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
4
- require 'bolt/config/transport/base'
3
+ require_relative '../../../bolt/error'
4
+ require_relative '../../../bolt/config/transport/base'
5
5
 
6
6
  module Bolt
7
7
  class Config
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
4
- require 'bolt/config/transport/base'
3
+ require_relative '../../../bolt/error'
4
+ require_relative '../../../bolt/config/transport/base'
5
5
 
6
6
  module Bolt
7
7
  class Config
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
4
- require 'bolt/config/transport/base'
3
+ require_relative '../../../bolt/error'
4
+ require_relative '../../../bolt/config/transport/base'
5
5
 
6
6
  module Bolt
7
7
  class Config
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
4
- require 'bolt/config/transport/base'
3
+ require_relative '../../../bolt/error'
4
+ require_relative '../../../bolt/config/transport/base'
5
5
 
6
6
  module Bolt
7
7
  class Config
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
4
- require 'bolt/config/transport/base'
3
+ require_relative '../../../bolt/error'
4
+ require_relative '../../../bolt/config/transport/base'
5
5
 
6
6
  module Bolt
7
7
  class Config
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
4
- require 'bolt/config/transport/base'
3
+ require_relative '../../../bolt/error'
4
+ require_relative '../../../bolt/config/transport/base'
5
5
 
6
6
  module Bolt
7
7
  class Config
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
4
- require 'bolt/config/transport/base'
3
+ require_relative '../../../bolt/error'
4
+ require_relative '../../../bolt/config/transport/base'
5
5
 
6
6
  module Bolt
7
7
  class Config
data/lib/bolt/config.rb CHANGED
@@ -3,11 +3,11 @@
3
3
  require 'etc'
4
4
  require 'logging'
5
5
  require 'pathname'
6
- require 'bolt/project'
7
- require 'bolt/logger'
8
- require 'bolt/util'
9
- require 'bolt/config/options'
10
- require 'bolt/validator'
6
+ require_relative '../bolt/project'
7
+ require_relative '../bolt/logger'
8
+ require_relative '../bolt/util'
9
+ require_relative 'config/options'
10
+ require_relative '../bolt/validator'
11
11
 
12
12
  module Bolt
13
13
  class UnknownTransportError < Bolt::Error