bolt 2.33.2 → 2.38.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 (77) hide show
  1. checksums.yaml +4 -4
  2. data/Puppetfile +1 -1
  3. data/bolt-modules/boltlib/lib/puppet/datatypes/applyresult.rb +1 -0
  4. data/bolt-modules/boltlib/lib/puppet/functions/catch_errors.rb +1 -3
  5. data/bolt-modules/boltlib/lib/puppet/functions/download_file.rb +17 -6
  6. data/bolt-modules/boltlib/lib/puppet/functions/parallelize.rb +56 -0
  7. data/bolt-modules/boltlib/lib/puppet/functions/run_command.rb +24 -6
  8. data/bolt-modules/boltlib/lib/puppet/functions/run_script.rb +27 -8
  9. data/bolt-modules/boltlib/lib/puppet/functions/run_task.rb +21 -1
  10. data/bolt-modules/boltlib/lib/puppet/functions/run_task_with.rb +18 -1
  11. data/bolt-modules/boltlib/lib/puppet/functions/upload_file.rb +24 -6
  12. data/lib/bolt/analytics.rb +27 -8
  13. data/lib/bolt/apply_result.rb +3 -3
  14. data/lib/bolt/bolt_option_parser.rb +48 -16
  15. data/lib/bolt/cli.rb +154 -249
  16. data/lib/bolt/config.rb +188 -55
  17. data/lib/bolt/config/options.rb +147 -87
  18. data/lib/bolt/config/transport/base.rb +10 -19
  19. data/lib/bolt/config/transport/local.rb +1 -7
  20. data/lib/bolt/config/transport/options.rb +10 -68
  21. data/lib/bolt/config/transport/ssh.rb +8 -14
  22. data/lib/bolt/error.rb +33 -3
  23. data/lib/bolt/executor.rb +92 -6
  24. data/lib/bolt/inventory.rb +25 -0
  25. data/lib/bolt/inventory/group.rb +2 -1
  26. data/lib/bolt/inventory/options.rb +130 -0
  27. data/lib/bolt/inventory/target.rb +10 -11
  28. data/lib/bolt/module_installer.rb +21 -13
  29. data/lib/bolt/module_installer/resolver.rb +1 -1
  30. data/lib/bolt/outputter.rb +19 -5
  31. data/lib/bolt/outputter/human.rb +41 -10
  32. data/lib/bolt/outputter/json.rb +1 -1
  33. data/lib/bolt/outputter/logger.rb +1 -1
  34. data/lib/bolt/outputter/rainbow.rb +13 -2
  35. data/lib/bolt/pal.rb +19 -7
  36. data/lib/bolt/pal/yaml_plan.rb +7 -0
  37. data/lib/bolt/plan_creator.rb +160 -0
  38. data/lib/bolt/plugin.rb +42 -13
  39. data/lib/bolt/plugin/cache.rb +76 -0
  40. data/lib/bolt/plugin/module.rb +4 -4
  41. data/lib/bolt/plugin/puppetdb.rb +1 -1
  42. data/lib/bolt/project.rb +59 -40
  43. data/lib/bolt/project_manager.rb +201 -0
  44. data/lib/bolt/{project_migrator/config.rb → project_manager/config_migrator.rb} +51 -5
  45. data/lib/bolt/{project_migrator/inventory.rb → project_manager/inventory_migrator.rb} +5 -5
  46. data/lib/bolt/{project_migrator/base.rb → project_manager/migrator.rb} +2 -2
  47. data/lib/bolt/{project_migrator/modules.rb → project_manager/module_migrator.rb} +5 -3
  48. data/lib/bolt/puppetdb/client.rb +11 -2
  49. data/lib/bolt/puppetdb/config.rb +9 -8
  50. data/lib/bolt/rerun.rb +1 -5
  51. data/lib/bolt/shell/bash.rb +8 -2
  52. data/lib/bolt/shell/powershell.rb +22 -4
  53. data/lib/bolt/target.rb +4 -0
  54. data/lib/bolt/task/run.rb +1 -1
  55. data/lib/bolt/transport/local.rb +13 -0
  56. data/lib/bolt/transport/orch.rb +0 -5
  57. data/lib/bolt/transport/orch/connection.rb +10 -3
  58. data/lib/bolt/transport/remote.rb +1 -1
  59. data/lib/bolt/transport/ssh/exec_connection.rb +6 -2
  60. data/lib/bolt/util.rb +41 -7
  61. data/lib/bolt/validator.rb +226 -0
  62. data/lib/bolt/version.rb +1 -1
  63. data/lib/bolt/yarn.rb +23 -0
  64. data/lib/bolt_server/base_config.rb +3 -1
  65. data/lib/bolt_server/config.rb +3 -1
  66. data/lib/bolt_server/file_cache.rb +2 -0
  67. data/lib/bolt_server/plugin.rb +13 -0
  68. data/lib/bolt_server/plugin/puppet_connect_data.rb +37 -0
  69. data/lib/bolt_server/schemas/connect-data.json +22 -0
  70. data/lib/bolt_server/schemas/partials/task.json +2 -2
  71. data/lib/bolt_server/transport_app.rb +82 -23
  72. data/lib/bolt_spec/plans/mock_executor.rb +4 -1
  73. data/libexec/apply_catalog.rb +1 -1
  74. data/libexec/custom_facts.rb +1 -1
  75. data/libexec/query_resources.rb +1 -1
  76. metadata +22 -13
  77. data/lib/bolt/project_migrator.rb +0 -80
@@ -17,12 +17,13 @@ module BoltSpec
17
17
 
18
18
  # Nothing on the executor is 'public'
19
19
  class MockExecutor
20
- attr_reader :noop, :error_message
20
+ attr_reader :noop, :error_message, :in_parallel
21
21
  attr_accessor :run_as, :transport_features, :execute_any_plan
22
22
 
23
23
  def initialize(modulepath)
24
24
  @noop = false
25
25
  @run_as = nil
26
+ @in_parallel = false
26
27
  @error_message = nil
27
28
  @allow_apply = false
28
29
  @modulepath = [modulepath].flatten.map { |path| File.absolute_path(path) }
@@ -133,6 +134,7 @@ module BoltSpec
133
134
  # through to another conditional statement
134
135
  doub = @plan_doubles[plan_name] || @plan_doubles[:default]
135
136
 
137
+ # rubocop:disable Lint/DuplicateBranch
136
138
  # High level:
137
139
  # - If we've explicitly allowed execution of the plan (normally the main plan
138
140
  # passed into BoltSpec::Plan::run_plan()), then execute it
@@ -165,6 +167,7 @@ module BoltSpec
165
167
  @error_message = "Unexpected call to 'run_plan(#{plan_name}, #{params_str})'"
166
168
  raise UnexpectedInvocation, @error_message
167
169
  end
170
+ # rubocop:enable Lint/DuplicateBranch
168
171
  result
169
172
  end
170
173
 
@@ -74,7 +74,7 @@ begin
74
74
  Puppet::ResourceApi::Transport.inject_device(type, transport)
75
75
 
76
76
  Puppet[:facts_terminus] = :network_device
77
- Puppet[:certname] = conn_info['uri']
77
+ Puppet[:certname] = conn_info['name']
78
78
  end
79
79
 
80
80
  # Ensure custom facts are available for provider suitability tests
@@ -51,7 +51,7 @@ Dir.mktmpdir do |puppet_root|
51
51
  Puppet::ResourceApi::Transport.inject_device(type, transport)
52
52
 
53
53
  Puppet[:facts_terminus] = :network_device
54
- Puppet[:certname] = conn_info['uri']
54
+ Puppet[:certname] = conn_info['name']
55
55
  end
56
56
 
57
57
  facts = Puppet::Node::Facts.indirection.find(SecureRandom.uuid, environment: env)
@@ -59,7 +59,7 @@ Dir.mktmpdir do |puppet_root|
59
59
  Puppet::ResourceApi::Transport.inject_device(type, transport)
60
60
 
61
61
  Puppet[:facts_terminus] = :network_device
62
- Puppet[:certname] = conn_info['uri']
62
+ Puppet[:certname] = conn_info['name']
63
63
  end
64
64
 
65
65
  resources = args['resources'].flat_map do |resource_desc|
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.33.2
4
+ version: 2.38.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-11-04 00:00:00.000000000 Z
11
+ date: 2020-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -185,9 +185,6 @@ dependencies:
185
185
  - - ">="
186
186
  - !ruby/object:Gem::Version
187
187
  version: 6.18.0
188
- - - "<"
189
- - !ruby/object:Gem::Version
190
- version: '6.20'
191
188
  type: :runtime
192
189
  prerelease: false
193
190
  version_requirements: !ruby/object:Gem::Requirement
@@ -195,9 +192,6 @@ dependencies:
195
192
  - - ">="
196
193
  - !ruby/object:Gem::Version
197
194
  version: 6.18.0
198
- - - "<"
199
- - !ruby/object:Gem::Version
200
- version: '6.20'
201
195
  - !ruby/object:Gem::Dependency
202
196
  name: puppetfile-resolver
203
197
  requirement: !ruby/object:Gem::Requirement
@@ -317,6 +311,9 @@ dependencies:
317
311
  - - ">="
318
312
  - !ruby/object:Gem::Version
319
313
  version: '1.14'
314
+ - - "<"
315
+ - !ruby/object:Gem::Version
316
+ version: 2.2.0
320
317
  type: :development
321
318
  prerelease: false
322
319
  version_requirements: !ruby/object:Gem::Requirement
@@ -324,6 +321,9 @@ dependencies:
324
321
  - - ">="
325
322
  - !ruby/object:Gem::Version
326
323
  version: '1.14'
324
+ - - "<"
325
+ - !ruby/object:Gem::Version
326
+ version: 2.2.0
327
327
  - !ruby/object:Gem::Dependency
328
328
  name: octokit
329
329
  requirement: !ruby/object:Gem::Requirement
@@ -404,6 +404,7 @@ files:
404
404
  - bolt-modules/boltlib/lib/puppet/functions/get_resources.rb
405
405
  - bolt-modules/boltlib/lib/puppet/functions/get_target.rb
406
406
  - bolt-modules/boltlib/lib/puppet/functions/get_targets.rb
407
+ - bolt-modules/boltlib/lib/puppet/functions/parallelize.rb
407
408
  - bolt-modules/boltlib/lib/puppet/functions/puppetdb_fact.rb
408
409
  - bolt-modules/boltlib/lib/puppet/functions/puppetdb_query.rb
409
410
  - bolt-modules/boltlib/lib/puppet/functions/remove_from_group.rb
@@ -468,6 +469,7 @@ files:
468
469
  - lib/bolt/inventory.rb
469
470
  - lib/bolt/inventory/group.rb
470
471
  - lib/bolt/inventory/inventory.rb
472
+ - lib/bolt/inventory/options.rb
471
473
  - lib/bolt/inventory/target.rb
472
474
  - lib/bolt/logger.rb
473
475
  - lib/bolt/module.rb
@@ -506,19 +508,21 @@ files:
506
508
  - lib/bolt/pal/yaml_plan/step/task.rb
507
509
  - lib/bolt/pal/yaml_plan/step/upload.rb
508
510
  - lib/bolt/pal/yaml_plan/transpiler.rb
511
+ - lib/bolt/plan_creator.rb
509
512
  - lib/bolt/plan_result.rb
510
513
  - lib/bolt/plugin.rb
514
+ - lib/bolt/plugin/cache.rb
511
515
  - lib/bolt/plugin/env_var.rb
512
516
  - lib/bolt/plugin/module.rb
513
517
  - lib/bolt/plugin/prompt.rb
514
518
  - lib/bolt/plugin/puppetdb.rb
515
519
  - lib/bolt/plugin/task.rb
516
520
  - lib/bolt/project.rb
517
- - lib/bolt/project_migrator.rb
518
- - lib/bolt/project_migrator/base.rb
519
- - lib/bolt/project_migrator/config.rb
520
- - lib/bolt/project_migrator/inventory.rb
521
- - lib/bolt/project_migrator/modules.rb
521
+ - lib/bolt/project_manager.rb
522
+ - lib/bolt/project_manager/config_migrator.rb
523
+ - lib/bolt/project_manager/inventory_migrator.rb
524
+ - lib/bolt/project_manager/migrator.rb
525
+ - lib/bolt/project_manager/module_migrator.rb
522
526
  - lib/bolt/puppetdb.rb
523
527
  - lib/bolt/puppetdb/client.rb
524
528
  - lib/bolt/puppetdb/config.rb
@@ -553,16 +557,21 @@ files:
553
557
  - lib/bolt/transport/winrm/connection.rb
554
558
  - lib/bolt/util.rb
555
559
  - lib/bolt/util/puppet_log_level.rb
560
+ - lib/bolt/validator.rb
556
561
  - lib/bolt/version.rb
562
+ - lib/bolt/yarn.rb
557
563
  - lib/bolt_server/acl.rb
558
564
  - lib/bolt_server/base_config.rb
559
565
  - lib/bolt_server/config.rb
560
566
  - lib/bolt_server/file_cache.rb
567
+ - lib/bolt_server/plugin.rb
568
+ - lib/bolt_server/plugin/puppet_connect_data.rb
561
569
  - lib/bolt_server/schemas/action-check_node_connections.json
562
570
  - lib/bolt_server/schemas/action-run_command.json
563
571
  - lib/bolt_server/schemas/action-run_script.json
564
572
  - lib/bolt_server/schemas/action-run_task.json
565
573
  - lib/bolt_server/schemas/action-upload_file.json
574
+ - lib/bolt_server/schemas/connect-data.json
566
575
  - lib/bolt_server/schemas/partials/target-any.json
567
576
  - lib/bolt_server/schemas/partials/target-ssh.json
568
577
  - lib/bolt_server/schemas/partials/target-winrm.json
@@ -1,80 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bolt/project_migrator/config'
4
- require 'bolt/project_migrator/inventory'
5
- require 'bolt/project_migrator/modules'
6
-
7
- module Bolt
8
- class ProjectMigrator
9
- def initialize(config, outputter)
10
- @config = config
11
- @outputter = outputter
12
- end
13
-
14
- def migrate
15
- unless $stdin.tty?
16
- raise Bolt::Error.new(
17
- "stdin is not a tty, unable to migrate project",
18
- 'bolt/stdin-not-a-tty-error'
19
- )
20
- end
21
-
22
- @outputter.print_message("Migrating project #{@config.project.path}\n\n")
23
-
24
- @outputter.print_action_step(
25
- "Migrating a Bolt project may make irreversible changes to the project's "\
26
- "configuration and inventory files. Before continuing, make sure the "\
27
- "project has a backup or uses a version control system."
28
- )
29
-
30
- return 0 unless Bolt::Util.prompt_yes_no("Continue with project migration?", @outputter)
31
-
32
- @outputter.print_message('')
33
-
34
- ok = migrate_inventory && migrate_config && migrate_modules
35
-
36
- if ok
37
- @outputter.print_message("Project successfully migrated")
38
- else
39
- @outputter.print_error("Project could not be migrated completely")
40
- end
41
-
42
- ok ? 0 : 1
43
- end
44
-
45
- # Migrates the project-level configuration file to the latest version.
46
- #
47
- private def migrate_config
48
- migrator = Bolt::ProjectMigrator::Config.new(@outputter)
49
-
50
- migrator.migrate(
51
- @config.project.config_file,
52
- @config.project.project_file,
53
- @config.inventoryfile || @config.project.inventory_file,
54
- @config.project.backup_dir
55
- )
56
- end
57
-
58
- # Migrates the inventory file to the latest version.
59
- #
60
- private def migrate_inventory
61
- migrator = Bolt::ProjectMigrator::Inventory.new(@outputter)
62
-
63
- migrator.migrate(
64
- @config.inventoryfile || @config.project.inventory_file,
65
- @config.project.backup_dir
66
- )
67
- end
68
-
69
- # Migrates the project's modules to use current best practices.
70
- #
71
- private def migrate_modules
72
- migrator = Bolt::ProjectMigrator::Modules.new(@outputter)
73
-
74
- migrator.migrate(
75
- @config.project,
76
- @config.modulepath
77
- )
78
- end
79
- end
80
- end