bolt 3.17.0 → 3.21.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 (104) hide show
  1. checksums.yaml +4 -4
  2. data/Puppetfile +14 -14
  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 +177 -12
  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 +87 -22
  14. data/lib/bolt/catalog.rb +10 -11
  15. data/lib/bolt/cli.rb +66 -24
  16. data/lib/bolt/config/modulepath.rb +1 -1
  17. data/lib/bolt/config/options.rb +42 -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/options.rb +3 -2
  23. data/lib/bolt/config/transport/orch.rb +2 -2
  24. data/lib/bolt/config/transport/podman.rb +2 -2
  25. data/lib/bolt/config/transport/remote.rb +2 -2
  26. data/lib/bolt/config/transport/ssh.rb +2 -2
  27. data/lib/bolt/config/transport/winrm.rb +2 -2
  28. data/lib/bolt/config.rb +9 -5
  29. data/lib/bolt/container_result.rb +2 -2
  30. data/lib/bolt/error.rb +1 -1
  31. data/lib/bolt/executor.rb +17 -14
  32. data/lib/bolt/fiber_executor.rb +2 -2
  33. data/lib/bolt/inventory/group.rb +4 -4
  34. data/lib/bolt/inventory/inventory.rb +3 -9
  35. data/lib/bolt/inventory/options.rb +1 -1
  36. data/lib/bolt/inventory/target.rb +1 -1
  37. data/lib/bolt/inventory.rb +8 -8
  38. data/lib/bolt/module_installer/installer.rb +2 -2
  39. data/lib/bolt/module_installer/puppetfile/forge_module.rb +1 -1
  40. data/lib/bolt/module_installer/puppetfile/git_module.rb +1 -1
  41. data/lib/bolt/module_installer/puppetfile/module.rb +1 -1
  42. data/lib/bolt/module_installer/puppetfile.rb +3 -3
  43. data/lib/bolt/module_installer/resolver.rb +3 -3
  44. data/lib/bolt/module_installer/specs/forge_spec.rb +1 -1
  45. data/lib/bolt/module_installer/specs/git_spec.rb +1 -1
  46. data/lib/bolt/module_installer/specs.rb +3 -3
  47. data/lib/bolt/module_installer.rb +6 -6
  48. data/lib/bolt/node/errors.rb +1 -1
  49. data/lib/bolt/node/output.rb +1 -1
  50. data/lib/bolt/outputter/human.rb +45 -2
  51. data/lib/bolt/outputter/json.rb +8 -0
  52. data/lib/bolt/outputter/logger.rb +1 -1
  53. data/lib/bolt/outputter/rainbow.rb +1 -1
  54. data/lib/bolt/outputter.rb +4 -4
  55. data/lib/bolt/pal/logging.rb +1 -1
  56. data/lib/bolt/pal/yaml_plan/evaluator.rb +1 -1
  57. data/lib/bolt/pal/yaml_plan/loader.rb +2 -2
  58. data/lib/bolt/pal/yaml_plan/step.rb +11 -11
  59. data/lib/bolt/pal/yaml_plan/transpiler.rb +3 -3
  60. data/lib/bolt/pal/yaml_plan.rb +2 -2
  61. data/lib/bolt/pal.rb +25 -11
  62. data/lib/bolt/plan_creator.rb +4 -4
  63. data/lib/bolt/plan_result.rb +2 -2
  64. data/lib/bolt/plugin/cache.rb +2 -2
  65. data/lib/bolt/plugin/module.rb +1 -1
  66. data/lib/bolt/plugin.rb +7 -7
  67. data/lib/bolt/project.rb +7 -5
  68. data/lib/bolt/project_manager/config_migrator.rb +1 -1
  69. data/lib/bolt/project_manager/inventory_migrator.rb +1 -1
  70. data/lib/bolt/project_manager/migrator.rb +1 -1
  71. data/lib/bolt/project_manager/module_migrator.rb +5 -5
  72. data/lib/bolt/project_manager.rb +23 -4
  73. data/lib/bolt/puppetdb/config.rb +1 -1
  74. data/lib/bolt/puppetdb.rb +3 -3
  75. data/lib/bolt/result.rb +1 -1
  76. data/lib/bolt/shell/bash.rb +14 -8
  77. data/lib/bolt/shell/powershell.rb +23 -4
  78. data/lib/bolt/shell.rb +2 -2
  79. data/lib/bolt/target.rb +2 -2
  80. data/lib/bolt/transport/base.rb +1 -1
  81. data/lib/bolt/transport/docker/connection.rb +1 -1
  82. data/lib/bolt/transport/docker.rb +2 -2
  83. data/lib/bolt/transport/local/connection.rb +2 -2
  84. data/lib/bolt/transport/local.rb +3 -3
  85. data/lib/bolt/transport/lxd/connection.rb +1 -1
  86. data/lib/bolt/transport/lxd.rb +4 -4
  87. data/lib/bolt/transport/orch.rb +2 -2
  88. data/lib/bolt/transport/podman/connection.rb +1 -1
  89. data/lib/bolt/transport/podman.rb +2 -2
  90. data/lib/bolt/transport/remote.rb +2 -2
  91. data/lib/bolt/transport/simple.rb +3 -3
  92. data/lib/bolt/transport/ssh/connection.rb +3 -3
  93. data/lib/bolt/transport/ssh.rb +5 -5
  94. data/lib/bolt/transport/winrm/connection.rb +2 -2
  95. data/lib/bolt/transport/winrm.rb +3 -3
  96. data/lib/bolt/util.rb +11 -31
  97. data/lib/bolt/validator.rb +1 -1
  98. data/lib/bolt/version.rb +1 -1
  99. data/lib/bolt.rb +1 -1
  100. data/lib/bolt_server/transport_app.rb +26 -5
  101. data/lib/bolt_spec/bolt_context.rb +6 -4
  102. data/lib/bolt_spec/plans/mock_executor.rb +3 -3
  103. data/libexec/bolt_catalog +1 -1
  104. metadata +6 -6
@@ -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
@@ -439,6 +439,10 @@ module Bolt
439
439
  @data['plugin-hooks']
440
440
  end
441
441
 
442
+ def policies
443
+ @data['policies']
444
+ end
445
+
442
446
  def trusted_external
443
447
  @data['trusted-external-command']
444
448
  end
@@ -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 ContainerResult
data/lib/bolt/error.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/util'
3
+ require_relative '../bolt/util'
4
4
 
5
5
  module Bolt
6
6
  class Error < RuntimeError
data/lib/bolt/executor.rb CHANGED
@@ -6,21 +6,21 @@ require 'json'
6
6
  require 'logging'
7
7
  require 'pathname'
8
8
  require 'set'
9
- require 'bolt/analytics'
10
- require 'bolt/config'
11
- require 'bolt/fiber_executor'
12
- require 'bolt/puppetdb'
13
- require 'bolt/result'
14
- require 'bolt/result_set'
9
+ require_relative '../bolt/analytics'
10
+ require_relative '../bolt/config'
11
+ require_relative '../bolt/fiber_executor'
12
+ require_relative '../bolt/puppetdb'
13
+ require_relative '../bolt/result'
14
+ require_relative '../bolt/result_set'
15
15
  # Load transports
16
- require 'bolt/transport/docker'
17
- require 'bolt/transport/local'
18
- require 'bolt/transport/lxd'
19
- require 'bolt/transport/orch'
20
- require 'bolt/transport/podman'
21
- require 'bolt/transport/remote'
22
- require 'bolt/transport/ssh'
23
- require 'bolt/transport/winrm'
16
+ require_relative '../bolt/transport/docker'
17
+ require_relative '../bolt/transport/local'
18
+ require_relative '../bolt/transport/lxd'
19
+ require_relative '../bolt/transport/orch'
20
+ require_relative '../bolt/transport/podman'
21
+ require_relative '../bolt/transport/remote'
22
+ require_relative '../bolt/transport/ssh'
23
+ require_relative '../bolt/transport/winrm'
24
24
 
25
25
  module Bolt
26
26
  TRANSPORTS = {
@@ -300,6 +300,9 @@ module Bolt
300
300
  description = options.fetch(:description, "script #{script}")
301
301
  log_action(description, targets) do
302
302
  options[:run_as] = run_as if run_as && !options.key?(:run_as)
303
+ options[:script_interpreter] = (future || {}).fetch('script_interpreter', false)
304
+
305
+ @analytics&.event('Future', 'script_interpreter', label: options[:script_interpreter].to_s)
303
306
 
304
307
  batch_execute(targets) do |transport, batch|
305
308
  with_node_logging("Running script #{script} with '#{arguments.to_json}'", batch) do
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/logger'
4
- require 'bolt/plan_future'
3
+ require_relative '../bolt/logger'
4
+ require_relative '../bolt/plan_future'
5
5
 
6
6
  module Bolt
7
7
  class FiberExecutor
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/config/options'
4
- require 'bolt/inventory/group'
5
- require 'bolt/inventory/inventory'
6
- require 'bolt/inventory/target'
3
+ require_relative '../../bolt/config/options'
4
+ require_relative '../../bolt/inventory/group'
5
+ require_relative '../../bolt/inventory/inventory'
6
+ require_relative '../../bolt/inventory/target'
7
7
 
8
8
  module Bolt
9
9
  class Inventory
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/inventory/group'
4
- require 'bolt/inventory/target'
3
+ require_relative '../../bolt/inventory/group'
4
+ require_relative '../../bolt/inventory/target'
5
5
 
6
6
  module Bolt
7
7
  class Inventory
@@ -71,16 +71,10 @@ module Bolt
71
71
  @config
72
72
  else
73
73
  @config_resolved = true
74
- @config.transform_values! { |t| t.resolved? ? t : t.resolve(@plugins) }
74
+ @config.each_value { |t| t.resolve(@plugins) unless t.resolved? }
75
75
  end
76
76
  end
77
77
 
78
- # Validates the inventory.
79
- #
80
- def validate
81
- groups.validate
82
- end
83
-
84
78
  def group_names_for(target_name)
85
79
  group_data_for(target_name).fetch('groups', [])
86
80
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/config/options'
3
+ require_relative '../../bolt/config/options'
4
4
 
5
5
  module Bolt
6
6
  class Inventory
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/resource_instance'
3
+ require_relative '../../bolt/resource_instance'
4
4
 
5
5
  module Bolt
6
6
  class Inventory
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'set'
4
- require 'bolt/config'
5
- require 'bolt/inventory/group'
6
- require 'bolt/inventory/inventory'
7
- require 'bolt/inventory/options'
8
- require 'bolt/target'
9
- require 'bolt/util'
10
- require 'bolt/plugin'
11
- require 'bolt/validator'
4
+ require_relative '../bolt/config'
5
+ require_relative 'inventory/group'
6
+ require_relative 'inventory/inventory'
7
+ require_relative 'inventory/options'
8
+ require_relative '../bolt/target'
9
+ require_relative '../bolt/util'
10
+ require_relative '../bolt/plugin'
11
+ require_relative '../bolt/validator'
12
12
  require 'yaml'
13
13
 
14
14
  module Bolt
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/r10k_log_proxy'
4
- require 'bolt/error'
3
+ require_relative '../../bolt/r10k_log_proxy'
4
+ require_relative '../../bolt/error'
5
5
 
6
6
  # This class is used to install modules from a Puppetfile to a module directory.
7
7
  #
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'semantic_puppet'
4
- require 'bolt/module_installer/puppetfile/module'
4
+ require_relative '../../../bolt/module_installer/puppetfile/module'
5
5
 
6
6
  # This class represents a resolved Forge module.
7
7
  #
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/module_installer/puppetfile/module'
3
+ require_relative '../../../bolt/module_installer/puppetfile/module'
4
4
 
5
5
  # This class represents a resolved Git module.
6
6
  #
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
3
+ require_relative '../../../bolt/error'
4
4
 
5
5
  module Bolt
6
6
  class ModuleInstaller
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
4
- require 'bolt/module_installer/puppetfile/forge_module'
5
- require 'bolt/module_installer/puppetfile/git_module'
3
+ require_relative '../../bolt/error'
4
+ require_relative 'puppetfile/forge_module'
5
+ require_relative 'puppetfile/git_module'
6
6
 
7
7
  # This class manages the logical contents of a Puppetfile. It includes methods
8
8
  # for parsing and generating a Puppetfile.
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
4
- require 'bolt/module_installer/puppetfile'
5
- require 'bolt/module_installer/specs'
3
+ require_relative '../../bolt/error'
4
+ require_relative '../../bolt/module_installer/puppetfile'
5
+ require_relative '../../bolt/module_installer/specs'
6
6
 
7
7
  module Bolt
8
8
  class ModuleInstaller
@@ -3,7 +3,7 @@
3
3
  require 'semantic_puppet'
4
4
  require 'set'
5
5
 
6
- require 'bolt/error'
6
+ require_relative '../../../bolt/error'
7
7
 
8
8
  # This class represents a Forge module specification.
9
9
  #
@@ -3,7 +3,7 @@
3
3
  require 'json'
4
4
  require 'set'
5
5
 
6
- require 'bolt/error'
6
+ require_relative '../../../bolt/error'
7
7
 
8
8
  # This class represents a Git module specification.
9
9
  #
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
4
- require 'bolt/module_installer/specs/forge_spec'
5
- require 'bolt/module_installer/specs/git_spec'
3
+ require_relative '../../bolt/error'
4
+ require_relative 'specs/forge_spec'
5
+ require_relative 'specs/git_spec'
6
6
 
7
7
  module Bolt
8
8
  class ModuleInstaller
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
4
- require 'bolt/logger'
5
- require 'bolt/module_installer/installer'
6
- require 'bolt/module_installer/puppetfile'
7
- require 'bolt/module_installer/resolver'
8
- require 'bolt/module_installer/specs'
3
+ require_relative '../bolt/error'
4
+ require_relative '../bolt/logger'
5
+ require_relative 'module_installer/installer'
6
+ require_relative 'module_installer/puppetfile'
7
+ require_relative 'module_installer/resolver'
8
+ require_relative 'module_installer/specs'
9
9
 
10
10
  module Bolt
11
11
  class ModuleInstaller
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
3
+ require_relative '../../bolt/error'
4
4
 
5
5
  module Bolt
6
6
  class Node
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'json'
4
- require 'bolt/result'
4
+ require_relative '../../bolt/result'
5
5
 
6
6
  module Bolt
7
7
  class Node
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/container_result'
4
- require 'bolt/pal'
3
+ require_relative '../../bolt/container_result'
4
+ require_relative '../../bolt/pal'
5
5
 
6
6
  module Bolt
7
7
  class Outputter
@@ -658,6 +658,49 @@ module Bolt
658
658
  OUTPUT
659
659
  end
660
660
 
661
+ def print_new_policy(name:, path:)
662
+ if Bolt::Util.powershell?
663
+ apply_command = "Invoke-BoltPolicy -Name #{name} -Targets <TARGETS>"
664
+ show_command = 'Get-BoltPolicy'
665
+ else
666
+ apply_command = "bolt policy apply #{name} --targets <TARGETS>"
667
+ show_command = 'bolt policy show'
668
+ end
669
+
670
+ print_message(<<~OUTPUT)
671
+ Created policy '#{name}' at '#{path}'
672
+
673
+ Apply this policy with:
674
+ #{apply_command}
675
+ Show available policies with:
676
+ #{show_command}
677
+ OUTPUT
678
+ end
679
+
680
+ # Print policies and the modulepath they are loaded from.
681
+ #
682
+ # @param policies [Array] The list of available policies.
683
+ # @param modulepath [Array] The project's modulepath.
684
+ #
685
+ def print_policy_list(policies:, modulepath:)
686
+ info = +''
687
+
688
+ info << colorize(:cyan, "Policies\n")
689
+
690
+ if policies.any?
691
+ policies.sort.each { |policy| info << indent(2, "#{policy}\n") }
692
+ else
693
+ info << indent(2, "No available policies\n")
694
+ end
695
+
696
+ info << "\n"
697
+
698
+ info << colorize(:cyan, "Modulepath\n")
699
+ info << indent(2, modulepath.join(File::PATH_SEPARATOR).to_s)
700
+
701
+ @stream.puts info.chomp
702
+ end
703
+
661
704
  # Print target names and where they came from.
662
705
  #
663
706
  # @param adhoc [Hash] Adhoc targets provided on the command line.
@@ -87,6 +87,10 @@ module Bolt
87
87
  @stream.puts plan.to_json
88
88
  end
89
89
 
90
+ def print_policy_list(**kwargs)
91
+ print_table(**kwargs)
92
+ end
93
+
90
94
  def print_plans(**kwargs)
91
95
  print_table(**kwargs)
92
96
  end
@@ -95,6 +99,10 @@ module Bolt
95
99
  print_table(**kwargs)
96
100
  end
97
101
 
102
+ def print_new_policy(**kwargs)
103
+ print_table(**kwargs)
104
+ end
105
+
98
106
  def print_apply_result(apply_result)
99
107
  @stream.puts apply_result.to_json
100
108
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/pal'
3
+ require_relative '../../bolt/pal'
4
4
 
5
5
  module Bolt
6
6
  class Outputter
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/pal'
3
+ require_relative '../../bolt/pal'
4
4
 
5
5
  module Bolt
6
6
  class Outputter
@@ -51,7 +51,7 @@ module Bolt
51
51
  end
52
52
  end
53
53
 
54
- require 'bolt/outputter/human'
55
- require 'bolt/outputter/json'
56
- require 'bolt/outputter/logger'
57
- require 'bolt/outputter/rainbow'
54
+ require_relative 'outputter/human'
55
+ require_relative 'outputter/json'
56
+ require_relative 'outputter/logger'
57
+ require_relative 'outputter/rainbow'
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/util/puppet_log_level'
3
+ require_relative '../../bolt/util/puppet_log_level'
4
4
 
5
5
  Puppet::Util::Log.newdesttype :logging do
6
6
  match "Logging::Logger"
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/pal/yaml_plan'
3
+ require_relative '../../../bolt/pal/yaml_plan'
4
4
 
5
5
  module Bolt
6
6
  class PAL
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/pal/yaml_plan'
4
- require 'bolt/pal/yaml_plan/evaluator'
3
+ require_relative '../../../bolt/pal/yaml_plan'
4
+ require_relative '../../../bolt/pal/yaml_plan/evaluator'
5
5
  require 'psych'
6
6
 
7
7
  module Bolt
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/util'
3
+ require_relative '../../../bolt/util'
4
4
 
5
5
  module Bolt
6
6
  class PAL
@@ -211,13 +211,13 @@ module Bolt
211
211
  end
212
212
  end
213
213
 
214
- require 'bolt/pal/yaml_plan/step/command'
215
- require 'bolt/pal/yaml_plan/step/eval'
216
- require 'bolt/pal/yaml_plan/step/plan'
217
- require 'bolt/pal/yaml_plan/step/resources'
218
- require 'bolt/pal/yaml_plan/step/script'
219
- require 'bolt/pal/yaml_plan/step/task'
220
- require 'bolt/pal/yaml_plan/step/upload'
221
- require 'bolt/pal/yaml_plan/step/download'
222
- require 'bolt/pal/yaml_plan/step/message'
223
- require 'bolt/pal/yaml_plan/step/verbose'
214
+ require_relative 'step/command'
215
+ require_relative 'step/eval'
216
+ require_relative 'step/plan'
217
+ require_relative 'step/resources'
218
+ require_relative 'step/script'
219
+ require_relative 'step/task'
220
+ require_relative 'step/upload'
221
+ require_relative 'step/download'
222
+ require_relative 'step/message'
223
+ require_relative 'step/verbose'
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
4
- require 'bolt/pal/yaml_plan/loader'
5
- require 'bolt/util'
3
+ require_relative '../../../bolt/error'
4
+ require_relative '../../../bolt/pal/yaml_plan/loader'
5
+ require_relative '../../../bolt/util'
6
6
 
7
7
  module Bolt
8
8
  class PAL
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/pal/yaml_plan/parameter'
4
- require 'bolt/pal/yaml_plan/step'
3
+ require_relative 'yaml_plan/parameter'
4
+ require_relative 'yaml_plan/step'
5
5
 
6
6
  module Bolt
7
7
  class PAL
data/lib/bolt/pal.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/applicator'
4
- require 'bolt/executor'
5
- require 'bolt/error'
6
- require 'bolt/plan_result'
7
- require 'bolt/util'
8
- require 'bolt/config/modulepath'
3
+ require_relative '../bolt/applicator'
4
+ require_relative '../bolt/executor'
5
+ require_relative '../bolt/error'
6
+ require_relative '../bolt/plan_result'
7
+ require_relative '../bolt/util'
8
+ require_relative '../bolt/config/modulepath'
9
9
  require 'etc'
10
10
 
11
11
  module Bolt
@@ -101,10 +101,10 @@ module Bolt
101
101
  raise Bolt::Error.new("Puppet must be installed to execute tasks", "bolt/puppet-missing")
102
102
  end
103
103
 
104
- require 'bolt/pal/logging'
105
- require 'bolt/pal/issues'
106
- require 'bolt/pal/yaml_plan/loader'
107
- require 'bolt/pal/yaml_plan/transpiler'
104
+ require_relative 'pal/logging'
105
+ require_relative 'pal/issues'
106
+ require_relative 'pal/yaml_plan/loader'
107
+ require_relative 'pal/yaml_plan/transpiler'
108
108
 
109
109
  # Now that puppet is loaded we can include puppet mixins in data types
110
110
  Bolt::ResultSet.include_iterable
@@ -238,6 +238,20 @@ module Bolt
238
238
  Puppet.override(opts, &block)
239
239
  end
240
240
 
241
+ def in_catalog_compiler
242
+ with_puppet_settings do
243
+ Puppet.override(bolt_project: @project) do
244
+ Puppet::Pal.in_tmp_environment('bolt', modulepath: full_modulepath) do |pal|
245
+ pal.with_catalog_compiler do |compiler|
246
+ yield compiler
247
+ end
248
+ end
249
+ end
250
+ rescue Puppet::Error => e
251
+ raise PALError.from_error(e)
252
+ end
253
+ end
254
+
241
255
  def in_plan_compiler(executor, inventory, pdb_client, applicator = nil)
242
256
  with_bolt_executor(executor, inventory, pdb_client, applicator) do
243
257
  # TODO: remove this call and see if anything breaks when
@@ -736,7 +750,7 @@ module Bolt
736
750
  #
737
751
  # Every future except for the main plan needs to have a plan id in
738
752
  # order to be tracked for the `wait()` function with no arguments.
739
- future = executor.create_future(name: plan_name, plan_id: 1) do |_scope|
753
+ future = executor.create_future(name: plan_name, plan_id: 0) do |_scope|
740
754
  r = compiler.call_function('run_plan', plan_name, params.merge('_bolt_api_call' => true))
741
755
  Bolt::PlanResult.from_pcore(r, 'success')
742
756
  rescue Bolt::Error => e
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
4
- require 'bolt/logger'
5
- require 'bolt/module'
6
- require 'bolt/util'
3
+ require_relative '../bolt/error'
4
+ require_relative '../bolt/logger'
5
+ require_relative '../bolt/module'
6
+ require_relative '../bolt/util'
7
7
 
8
8
  module Bolt
9
9
  module PlanCreator
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'json'
4
- require 'bolt/error'
5
- require 'bolt/util'
4
+ require_relative '../bolt/error'
5
+ require_relative '../bolt/util'
6
6
 
7
7
  module Bolt
8
8
  class PlanResult