bolt 3.13.0 → 3.16.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.

Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/Puppetfile +1 -1
  3. data/bolt-modules/boltlib/lib/puppet/functions/apply_prep.rb +137 -104
  4. data/bolt-modules/boltlib/lib/puppet/functions/background.rb +2 -1
  5. data/bolt-modules/boltlib/lib/puppet/functions/parallelize.rb +5 -1
  6. data/bolt-modules/boltlib/lib/puppet/functions/run_plan.rb +13 -0
  7. data/bolt-modules/boltlib/lib/puppet/functions/wait.rb +47 -7
  8. data/bolt-modules/out/lib/puppet/functions/out/message.rb +4 -2
  9. data/bolt-modules/out/lib/puppet/functions/out/verbose.rb +4 -2
  10. data/guides/{debugging.txt → debugging.yaml} +5 -6
  11. data/guides/{inventory.txt → inventory.yaml} +6 -7
  12. data/guides/{links.txt → links.yaml} +3 -4
  13. data/guides/{logging.txt → logging.yaml} +5 -6
  14. data/guides/{module.txt → module.yaml} +5 -6
  15. data/guides/{modulepath.txt → modulepath.yaml} +5 -6
  16. data/guides/{project.txt → project.yaml} +6 -7
  17. data/guides/{targets.txt → targets.yaml} +5 -6
  18. data/guides/{transports.txt → transports.yaml} +6 -7
  19. data/lib/bolt/analytics.rb +3 -20
  20. data/lib/bolt/application.rb +620 -0
  21. data/lib/bolt/bolt_option_parser.rb +17 -5
  22. data/lib/bolt/cli.rb +592 -772
  23. data/lib/bolt/config/transport/options.rb +12 -0
  24. data/lib/bolt/config/transport/ssh.rb +7 -0
  25. data/lib/bolt/executor.rb +12 -4
  26. data/lib/bolt/fiber_executor.rb +63 -14
  27. data/lib/bolt/module_installer/puppetfile.rb +24 -10
  28. data/lib/bolt/outputter/human.rb +199 -43
  29. data/lib/bolt/outputter/json.rb +66 -43
  30. data/lib/bolt/outputter/logger.rb +1 -1
  31. data/lib/bolt/pal.rb +67 -14
  32. data/lib/bolt/pal/yaml_plan/step.rb +2 -0
  33. data/lib/bolt/pal/yaml_plan/step/message.rb +0 -8
  34. data/lib/bolt/pal/yaml_plan/step/verbose.rb +31 -0
  35. data/lib/bolt/pal/yaml_plan/transpiler.rb +1 -1
  36. data/lib/bolt/plan_creator.rb +2 -20
  37. data/lib/bolt/plan_future.rb +23 -3
  38. data/lib/bolt/plan_result.rb +1 -1
  39. data/lib/bolt/plugin/task.rb +1 -1
  40. data/lib/bolt/project.rb +0 -7
  41. data/lib/bolt/result_set.rb +2 -1
  42. data/lib/bolt/transport/local/connection.rb +17 -1
  43. data/lib/bolt/transport/orch/connection.rb +13 -1
  44. data/lib/bolt/transport/ssh/exec_connection.rb +3 -1
  45. data/lib/bolt/version.rb +1 -1
  46. data/lib/bolt_server/file_cache.rb +12 -0
  47. data/lib/bolt_server/schemas/action-apply.json +32 -0
  48. data/lib/bolt_server/schemas/action-apply_prep.json +19 -0
  49. data/lib/bolt_server/schemas/partials/target-ssh.json +4 -0
  50. data/lib/bolt_server/schemas/partials/target-winrm.json +4 -0
  51. data/lib/bolt_server/transport_app.rb +180 -60
  52. data/lib/bolt_spec/plans/mock_executor.rb +16 -6
  53. metadata +23 -15
  54. data/guides/guide.txt +0 -17
  55. data/lib/bolt/secret.rb +0 -37
@@ -39,6 +39,7 @@ module BoltSpec
39
39
  # plans that are allowed to be executed by the @executor_real
40
40
  @allowed_exec_plans = {}
41
41
  @id = 0
42
+ @plan_futures = []
42
43
  end
43
44
 
44
45
  def module_file_id(file)
@@ -280,7 +281,7 @@ module BoltSpec
280
281
  false
281
282
  end
282
283
 
283
- def create_future(scope: nil, name: nil)
284
+ def create_future(plan_id:, scope: nil, name: nil)
284
285
  newscope = nil
285
286
  if scope
286
287
  # Create the new scope
@@ -295,13 +296,18 @@ module BoltSpec
295
296
  # Execute "futures" serially when running in BoltSpec
296
297
  result = yield newscope
297
298
  @id += 1
298
- future = Bolt::PlanFuture.new(nil, @id, name: name)
299
+ future = Bolt::PlanFuture.new(nil, @id, name: name, plan_id: plan_id)
299
300
  future.value = result
301
+ @plan_futures << future
300
302
  future
301
303
  end
302
304
 
303
- def wait(results, **_kwargs)
304
- results
305
+ def get_futures_for_plan(plan_id:)
306
+ @plan_futures.select { |future| future.plan_id == plan_id }
307
+ end
308
+
309
+ def wait(futures, **_kwargs)
310
+ futures.map(&:value)
305
311
  end
306
312
 
307
313
  # Since Futures are executed immediately once created, this will always
@@ -310,8 +316,12 @@ module BoltSpec
310
316
  true
311
317
  end
312
318
 
313
- def plan_futures
314
- []
319
+ def get_current_future(fiber)
320
+ @plan_futures.select { |f| f.fiber == fiber }&.first
321
+ end
322
+
323
+ def get_current_plan_id(fiber)
324
+ get_current_future(fiber)&.current_plan
315
325
  end
316
326
 
317
327
  # Public methods on Bolt::Executor that need to be mocked so there aren't
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.13.0
4
+ version: 3.16.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-12 00:00:00.000000000 Z
11
+ date: 2021-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -70,16 +70,22 @@ dependencies:
70
70
  name: ffi
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 1.9.25
73
76
  - - "<"
74
77
  - !ruby/object:Gem::Version
75
- version: 1.14.0
78
+ version: 2.0.0
76
79
  type: :runtime
77
80
  prerelease: false
78
81
  version_requirements: !ruby/object:Gem::Requirement
79
82
  requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: 1.9.25
80
86
  - - "<"
81
87
  - !ruby/object:Gem::Version
82
- version: 1.14.0
88
+ version: 2.0.0
83
89
  - !ruby/object:Gem::Dependency
84
90
  name: hiera-eyaml
85
91
  requirement: !ruby/object:Gem::Requirement
@@ -460,18 +466,18 @@ files:
460
466
  - bolt-modules/prompt/lib/puppet/functions/prompt/menu.rb
461
467
  - bolt-modules/system/lib/puppet/functions/system/env.rb
462
468
  - exe/bolt
463
- - guides/debugging.txt
464
- - guides/guide.txt
465
- - guides/inventory.txt
466
- - guides/links.txt
467
- - guides/logging.txt
468
- - guides/module.txt
469
- - guides/modulepath.txt
470
- - guides/project.txt
471
- - guides/targets.txt
472
- - guides/transports.txt
469
+ - guides/debugging.yaml
470
+ - guides/inventory.yaml
471
+ - guides/links.yaml
472
+ - guides/logging.yaml
473
+ - guides/module.yaml
474
+ - guides/modulepath.yaml
475
+ - guides/project.yaml
476
+ - guides/targets.yaml
477
+ - guides/transports.yaml
473
478
  - lib/bolt.rb
474
479
  - lib/bolt/analytics.rb
480
+ - lib/bolt/application.rb
475
481
  - lib/bolt/applicator.rb
476
482
  - lib/bolt/apply_inventory.rb
477
483
  - lib/bolt/apply_result.rb
@@ -538,6 +544,7 @@ files:
538
544
  - lib/bolt/pal/yaml_plan/step/script.rb
539
545
  - lib/bolt/pal/yaml_plan/step/task.rb
540
546
  - lib/bolt/pal/yaml_plan/step/upload.rb
547
+ - lib/bolt/pal/yaml_plan/step/verbose.rb
541
548
  - lib/bolt/pal/yaml_plan/transpiler.rb
542
549
  - lib/bolt/plan_creator.rb
543
550
  - lib/bolt/plan_future.rb
@@ -564,7 +571,6 @@ files:
564
571
  - lib/bolt/resource_instance.rb
565
572
  - lib/bolt/result.rb
566
573
  - lib/bolt/result_set.rb
567
- - lib/bolt/secret.rb
568
574
  - lib/bolt/shell.rb
569
575
  - lib/bolt/shell/bash.rb
570
576
  - lib/bolt/shell/bash/tmpdir.rb
@@ -604,6 +610,8 @@ files:
604
610
  - lib/bolt_server/plugin.rb
605
611
  - lib/bolt_server/plugin/puppet_connect_data.rb
606
612
  - lib/bolt_server/request_error.rb
613
+ - lib/bolt_server/schemas/action-apply.json
614
+ - lib/bolt_server/schemas/action-apply_prep.json
607
615
  - lib/bolt_server/schemas/action-check_node_connections.json
608
616
  - lib/bolt_server/schemas/action-run_command.json
609
617
  - lib/bolt_server/schemas/action-run_script.json
data/guides/guide.txt DELETED
@@ -1,17 +0,0 @@
1
- TOPIC
2
- guide
3
-
4
- DESCRIPTION
5
- A guide is a person (or CLI tool ;D) who leads travelers through unknown or
6
- unfamiliar locations. The term can also be applied to a person who leads others
7
- to more abstract goals such as knowledge or wisdom.
8
-
9
- Etymology: Originated sometime between 1325 and 1375. From Middle English
10
- guide, from the Old French guide, from Old Occitan guida, from guidar, from
11
- Frankish *wītan (“to show the way, lead”), from Proto-Germanic *wītaną (“to
12
- see, know; go, depart”), from Proto-Indo-European *weyd- (“to see, know”).
13
- Related also to English wit.
14
-
15
- DOCUMENTATION
16
- https://en.wikipedia.org/wiki/Guide
17
- https://en.wiktionary.org/wiki/guide
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