bolt 3.15.0 → 3.18.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 (111) hide show
  1. checksums.yaml +4 -4
  2. data/Puppetfile +7 -7
  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 +4 -21
  9. data/lib/bolt/application.rb +627 -0
  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 +27 -3
  14. data/lib/bolt/catalog.rb +10 -11
  15. data/lib/bolt/cli.rb +607 -809
  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 +9 -5
  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 +85 -34
  50. data/lib/bolt/outputter/json.rb +63 -38
  51. data/lib/bolt/outputter/logger.rb +1 -1
  52. data/lib/bolt/outputter/rainbow.rb +1 -1
  53. data/lib/bolt/outputter.rb +4 -4
  54. data/lib/bolt/pal/logging.rb +1 -1
  55. data/lib/bolt/pal/yaml_plan/evaluator.rb +1 -1
  56. data/lib/bolt/pal/yaml_plan/loader.rb +2 -2
  57. data/lib/bolt/pal/yaml_plan/step.rb +11 -11
  58. data/lib/bolt/pal/yaml_plan/transpiler.rb +3 -3
  59. data/lib/bolt/pal/yaml_plan.rb +2 -2
  60. data/lib/bolt/pal.rb +11 -11
  61. data/lib/bolt/plan_creator.rb +88 -29
  62. data/lib/bolt/plan_future.rb +11 -6
  63. data/lib/bolt/plan_result.rb +3 -3
  64. data/lib/bolt/plugin/cache.rb +2 -2
  65. data/lib/bolt/plugin/module.rb +1 -1
  66. data/lib/bolt/plugin.rb +18 -24
  67. data/lib/bolt/project.rb +4 -11
  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/result_set.rb +2 -1
  77. data/lib/bolt/shell/bash.rb +12 -2
  78. data/lib/bolt/shell/powershell.rb +9 -2
  79. data/lib/bolt/shell.rb +2 -2
  80. data/lib/bolt/target.rb +2 -2
  81. data/lib/bolt/transport/base.rb +1 -1
  82. data/lib/bolt/transport/docker/connection.rb +1 -1
  83. data/lib/bolt/transport/docker.rb +2 -2
  84. data/lib/bolt/transport/local/connection.rb +19 -3
  85. data/lib/bolt/transport/local.rb +3 -3
  86. data/lib/bolt/transport/lxd/connection.rb +1 -1
  87. data/lib/bolt/transport/lxd.rb +4 -4
  88. data/lib/bolt/transport/orch/connection.rb +13 -1
  89. data/lib/bolt/transport/orch.rb +2 -2
  90. data/lib/bolt/transport/podman/connection.rb +1 -1
  91. data/lib/bolt/transport/podman.rb +2 -2
  92. data/lib/bolt/transport/remote.rb +2 -2
  93. data/lib/bolt/transport/simple.rb +3 -3
  94. data/lib/bolt/transport/ssh/connection.rb +3 -3
  95. data/lib/bolt/transport/ssh.rb +5 -5
  96. data/lib/bolt/transport/winrm/connection.rb +2 -2
  97. data/lib/bolt/transport/winrm.rb +3 -3
  98. data/lib/bolt/util.rb +8 -31
  99. data/lib/bolt/validator.rb +1 -1
  100. data/lib/bolt/version.rb +1 -1
  101. data/lib/bolt.rb +1 -1
  102. data/lib/bolt_server/file_cache.rb +12 -0
  103. data/lib/bolt_server/schemas/action-apply.json +32 -0
  104. data/lib/bolt_server/schemas/action-apply_prep.json +19 -0
  105. data/lib/bolt_server/transport_app.rb +129 -26
  106. data/lib/bolt_spec/bolt_context.rb +7 -5
  107. data/lib/bolt_spec/plans/mock_executor.rb +3 -3
  108. data/lib/bolt_spec/run.rb +1 -1
  109. data/libexec/bolt_catalog +1 -1
  110. metadata +7 -5
  111. data/lib/bolt/secret.rb +0 -37
@@ -39,13 +39,15 @@ require 'bolt/plugin'
39
39
  #
40
40
  # Stubs:
41
41
  # - allow_command(cmd), expect_command(cmd): expect the exact command
42
- # - allow_script(script), expect_script(script): expect the script as <module>/path/to/file
42
+ # - allow_script(script), expect_script(script): expect the script as <module>/path/to/file or an absolute path
43
43
  # - allow_task(task), expect_task(task): expect the named task
44
44
  # - allow_download(file), expect_download(file): expect the identified source file
45
- # - allow_upload(file), expect_upload(file): expect the identified source file
45
+ # - allow_upload(file), expect_upload(file): expect the source file as <module>/path/to/file or an absolute path
46
46
  # - allow_out_message, expect_out_message: expect a message to be passed to out::message (only modifiers are
47
47
  # be_called_times(n), with_params(params), and not_be_called)
48
48
  #
49
+ # Files with absolute path (for upload and script) must exist or those functions will fail.
50
+ #
49
51
  # Stub modifiers:
50
52
  # - be_called_times(n): if allowed, fail if the action is called more than 'n' times
51
53
  # if expected, fail unless the action is called 'n' times
@@ -154,7 +156,7 @@ module BoltSpec
154
156
  end
155
157
 
156
158
  def plugins
157
- @plugins ||= Bolt::Plugin.setup(config, pal)
159
+ @plugins ||= Bolt::Plugin.new(config, pal)
158
160
  end
159
161
 
160
162
  def pal
@@ -211,8 +213,8 @@ module BoltSpec
211
213
  # def allow_script(script_name)
212
214
  #
213
215
  # file uploads and downloads have a single destination and no arguments
214
- # def allow_file_upload(source_name)
215
- # def allow_file_download(source_name)
216
+ # def allow_upload(source_name)
217
+ # def allow_download(source_name)
216
218
  #
217
219
  # Most of the information in commands is in the command string itself
218
220
  # we may need more flexible allows than just the name/command string
@@ -44,7 +44,7 @@ module BoltSpec
44
44
 
45
45
  def module_file_id(file)
46
46
  modpath = @modulepath.select { |path| file =~ /^#{path}/ }
47
- raise "Could not identify modulepath containing #{file}: #{modpath}" unless modpath.size == 1
47
+ return nil unless modpath.size == 1
48
48
 
49
49
  path = Pathname.new(file)
50
50
  relative = path.relative_path_from(Pathname.new(modpath.first))
@@ -66,7 +66,7 @@ module BoltSpec
66
66
  end
67
67
 
68
68
  def run_script(targets, script_path, arguments, options = {}, _position = [])
69
- script = module_file_id(script_path)
69
+ script = module_file_id(script_path) || script_path
70
70
  result = nil
71
71
  if (doub = @script_doubles[script] || @script_doubles[:default])
72
72
  result = doub.process(targets, script, arguments, options)
@@ -116,7 +116,7 @@ module BoltSpec
116
116
  end
117
117
 
118
118
  def upload_file(targets, source_path, destination, options = {}, _position = [])
119
- source = module_file_id(source_path)
119
+ source = module_file_id(source_path) || source_path
120
120
  result = nil
121
121
  if (doub = @upload_doubles[source] || @upload_doubles[:default])
122
122
  result = doub.process(targets, source, destination, options)
data/lib/bolt_spec/run.rb CHANGED
@@ -171,7 +171,7 @@ module BoltSpec
171
171
  end
172
172
 
173
173
  def plugins
174
- @plugins ||= Bolt::Plugin.setup(config, pal)
174
+ @plugins ||= Bolt::Plugin.new(config, pal)
175
175
  end
176
176
 
177
177
  def puppetdb_client
data/libexec/bolt_catalog CHANGED
@@ -59,7 +59,7 @@ when "compile"
59
59
  puts({ message: message, backtrace: e.backtrace }.to_json)
60
60
  exit 1
61
61
  rescue StandardError => e
62
- puts({ message: e.message }.to_json)
62
+ puts({ message: e.message, backtrace: e.backtrace }.to_json)
63
63
  exit 1
64
64
  end
65
65
  else
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: 3.15.0
4
+ version: 3.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-02 00:00:00.000000000 Z
11
+ date: 2021-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -260,14 +260,14 @@ dependencies:
260
260
  requirements:
261
261
  - - "~>"
262
262
  - !ruby/object:Gem::Version
263
- version: '3.1'
263
+ version: '3.10'
264
264
  type: :runtime
265
265
  prerelease: false
266
266
  version_requirements: !ruby/object:Gem::Requirement
267
267
  requirements:
268
268
  - - "~>"
269
269
  - !ruby/object:Gem::Version
270
- version: '3.1'
270
+ version: '3.10'
271
271
  - !ruby/object:Gem::Dependency
272
272
  name: ruby_smb
273
273
  requirement: !ruby/object:Gem::Requirement
@@ -477,6 +477,7 @@ files:
477
477
  - guides/transports.yaml
478
478
  - lib/bolt.rb
479
479
  - lib/bolt/analytics.rb
480
+ - lib/bolt/application.rb
480
481
  - lib/bolt/applicator.rb
481
482
  - lib/bolt/apply_inventory.rb
482
483
  - lib/bolt/apply_result.rb
@@ -570,7 +571,6 @@ files:
570
571
  - lib/bolt/resource_instance.rb
571
572
  - lib/bolt/result.rb
572
573
  - lib/bolt/result_set.rb
573
- - lib/bolt/secret.rb
574
574
  - lib/bolt/shell.rb
575
575
  - lib/bolt/shell/bash.rb
576
576
  - lib/bolt/shell/bash/tmpdir.rb
@@ -610,6 +610,8 @@ files:
610
610
  - lib/bolt_server/plugin.rb
611
611
  - lib/bolt_server/plugin/puppet_connect_data.rb
612
612
  - lib/bolt_server/request_error.rb
613
+ - lib/bolt_server/schemas/action-apply.json
614
+ - lib/bolt_server/schemas/action-apply_prep.json
613
615
  - lib/bolt_server/schemas/action-check_node_connections.json
614
616
  - lib/bolt_server/schemas/action-run_command.json
615
617
  - lib/bolt_server/schemas/action-run_script.json
data/lib/bolt/secret.rb DELETED
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bolt/plugin'
4
-
5
- module Bolt
6
- class Secret
7
- KNOWN_KEYS = {
8
- 'createkeys' => %w[keysize private_key public_key],
9
- 'encrypt' => %w[public_key],
10
- 'decrypt' => %w[private_key public_key]
11
- }.freeze
12
-
13
- def self.execute(plugins, outputter, options)
14
- name = options[:plugin] || 'pkcs7'
15
- plugin = plugins.by_name(name)
16
-
17
- unless plugin
18
- raise Bolt::Plugin::PluginError::Unknown, name
19
- end
20
-
21
- case options[:action]
22
- when 'createkeys'
23
- opts = { 'force' => options[:force] }.compact
24
- result = plugins.get_hook(name, :secret_createkeys).call(opts)
25
- outputter.print_message(result)
26
- when 'encrypt'
27
- encrypted = plugins.get_hook(name, :secret_encrypt).call('plaintext_value' => options[:object])
28
- outputter.print_message(encrypted)
29
- when 'decrypt'
30
- decrypted = plugins.get_hook(name, :secret_decrypt).call('encrypted_value' => options[:object])
31
- outputter.print_message(decrypted)
32
- end
33
-
34
- 0
35
- end
36
- end
37
- end