bolt 1.19.0 → 1.20.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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/bolt-modules/boltlib/lib/puppet/datatypes/applyresult.rb +2 -0
  3. data/bolt-modules/boltlib/lib/puppet/datatypes/result.rb +2 -0
  4. data/bolt-modules/boltlib/lib/puppet/datatypes/resultset.rb +1 -0
  5. data/bolt-modules/boltlib/lib/puppet/functions/add_facts.rb +3 -10
  6. data/bolt-modules/boltlib/lib/puppet/functions/add_to_group.rb +3 -10
  7. data/bolt-modules/boltlib/lib/puppet/functions/apply_prep.rb +3 -9
  8. data/bolt-modules/boltlib/lib/puppet/functions/facts.rb +2 -8
  9. data/bolt-modules/boltlib/lib/puppet/functions/fail_plan.rb +2 -2
  10. data/bolt-modules/boltlib/lib/puppet/functions/get_resources.rb +3 -8
  11. data/bolt-modules/boltlib/lib/puppet/functions/get_targets.rb +2 -8
  12. data/bolt-modules/boltlib/lib/puppet/functions/puppetdb_fact.rb +2 -7
  13. data/bolt-modules/boltlib/lib/puppet/functions/puppetdb_query.rb +2 -7
  14. data/bolt-modules/boltlib/lib/puppet/functions/run_command.rb +2 -7
  15. data/bolt-modules/boltlib/lib/puppet/functions/run_plan.rb +1 -6
  16. data/bolt-modules/boltlib/lib/puppet/functions/run_script.rb +2 -7
  17. data/bolt-modules/boltlib/lib/puppet/functions/run_task.rb +7 -33
  18. data/bolt-modules/boltlib/lib/puppet/functions/set_feature.rb +3 -10
  19. data/bolt-modules/boltlib/lib/puppet/functions/set_var.rb +3 -10
  20. data/bolt-modules/boltlib/lib/puppet/functions/upload_file.rb +2 -7
  21. data/bolt-modules/boltlib/lib/puppet/functions/vars.rb +2 -8
  22. data/bolt-modules/boltlib/lib/puppet/functions/wait_until_available.rb +2 -7
  23. data/bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb +1 -1
  24. data/lib/bolt/applicator.rb +7 -3
  25. data/lib/bolt/apply_result.rb +8 -21
  26. data/lib/bolt/bolt_option_parser.rb +2 -2
  27. data/lib/bolt/catalog.rb +0 -1
  28. data/lib/bolt/cli.rb +51 -29
  29. data/lib/bolt/config.rb +0 -2
  30. data/lib/bolt/executor.rb +38 -50
  31. data/lib/bolt/inventory/group.rb +5 -0
  32. data/lib/bolt/inventory/group2.rb +5 -0
  33. data/lib/bolt/logger.rb +7 -3
  34. data/lib/bolt/outputter.rb +6 -4
  35. data/lib/bolt/outputter/human.rb +90 -6
  36. data/lib/bolt/outputter/json.rb +4 -4
  37. data/lib/bolt/outputter/logger.rb +53 -0
  38. data/lib/bolt/pal.rb +3 -3
  39. data/lib/bolt/pal/yaml_plan/step.rb +1 -1
  40. data/lib/bolt/plugin.rb +2 -0
  41. data/lib/bolt/plugin/terraform.rb +84 -0
  42. data/lib/bolt/result.rb +12 -8
  43. data/lib/bolt/result_set.rb +4 -0
  44. data/lib/bolt/transport/orch.rb +4 -4
  45. data/lib/bolt/version.rb +1 -1
  46. metadata +4 -3
  47. data/lib/bolt/notifier.rb +0 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d56ec91fb5d2a032a164f87f30ece4f103b93e3957dbff221ea775e5c52af0e1
4
- data.tar.gz: cad130dc12fcba0d3fa39feb61603b9fe801373c04c62a9306958dff7bac13cd
3
+ metadata.gz: 12222d708d8694206992e7cb2e89271c4b94ee9a56c40800f723d4f88899ba2f
4
+ data.tar.gz: 8206b12db4fdd4fc2503252b1671f97f34e4870533baa244accf8b8bb94214e6
5
5
  SHA512:
6
- metadata.gz: 566a3c7f134067783fb458db050eee4058c43d97ac44f87caf598589f9a6761b68e6150b65bac8cb8f63e65708d1c73a9391501244f87732ae89802f9a169302
7
- data.tar.gz: c69f7762b1f76c311526ac63ed01c60d993b2b638acc84e76920fb4971edc41aec1bb7a227cc4475c35189733fe50748d9c1c556d2dd7e290d35df7bd7141f99
6
+ metadata.gz: eb78a8b55b5490ca241c513a4be0be6b1ab062109c1895fcdcd11bf802c9540da4cfee2625b8b080821e20d8902795e3845244669cf2b9efe2e15be102bd8662
7
+ data.tar.gz: ad3321dc6ab500619ddb65083e0af52ff73949fea3e0330da15d0f7c3641d08a0a7a8fd44fca7705063952a654f2ed32893520b3cdcff7bc73dcecc3e07c5d6c
@@ -10,6 +10,8 @@ Puppet::DataTypes.create_type('ApplyResult') do
10
10
  error => Callable[[], Optional[Error]],
11
11
  ok => Callable[[], Boolean],
12
12
  message => Callable[[], Optional[String]],
13
+ action => Callable[[], String],
14
+ to_data => Callable[[], Hash],
13
15
  }
14
16
  PUPPET
15
17
 
@@ -9,6 +9,8 @@ Puppet::DataTypes.create_type('Result') do
9
9
  functions => {
10
10
  error => Callable[[], Optional[Error]],
11
11
  message => Callable[[], Optional[String]],
12
+ action => Callable[[], String],
13
+ to_data => Callable[[], Hash],
12
14
  ok => Callable[[], Boolean],
13
15
  '[]' => Callable[[String[1]], Data]
14
16
  }
@@ -15,6 +15,7 @@ Puppet::DataTypes.create_type('ResultSet') do
15
15
  ok => Callable[[], Boolean],
16
16
  ok_set => Callable[[], ResultSet],
17
17
  targets => Callable[[], Array[Target]],
18
+ to_data => Callable[[], Array[Hash]],
18
19
  }
19
20
  PUPPET
20
21
 
@@ -23,16 +23,9 @@ Puppet::Functions.create_function(:add_facts) do
23
23
  .from_issue_and_stack(Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, action: 'add_facts')
24
24
  end
25
25
 
26
- inventory = Puppet.lookup(:bolt_inventory) { nil }
27
-
28
- unless inventory
29
- raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
30
- Puppet::Pops::Issues::TASK_MISSING_BOLT, action: _('add facts')
31
- )
32
- end
33
-
34
- executor = Puppet.lookup(:bolt_executor) { nil }
35
- executor&.report_function_call('add_facts')
26
+ inventory = Puppet.lookup(:bolt_inventory)
27
+ executor = Puppet.lookup(:bolt_executor)
28
+ executor.report_function_call('add_facts')
36
29
 
37
30
  inventory.add_facts(target, facts)
38
31
  end
@@ -27,16 +27,9 @@ Puppet::Functions.create_function(:add_to_group) do
27
27
  .from_issue_and_stack(Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, action: 'add_to_group')
28
28
  end
29
29
 
30
- inventory = Puppet.lookup(:bolt_inventory) { nil }
31
-
32
- unless inventory && Puppet.features.bolt?
33
- raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
34
- Puppet::Pops::Issues::TASK_MISSING_BOLT, action: _('process targets through inventory')
35
- )
36
- end
37
-
38
- executor = Puppet.lookup(:bolt_executor) { nil }
39
- executor&.report_function_call('add_to_group')
30
+ inventory = Puppet.lookup(:bolt_inventory)
31
+ executor = Puppet.lookup(:bolt_executor)
32
+ executor.report_function_call('add_to_group')
40
33
 
41
34
  inventory.add_to_group(inventory.get_targets(targets), group)
42
35
  end
@@ -46,15 +46,9 @@ Puppet::Functions.create_function(:apply_prep) do
46
46
  .from_issue_and_stack(Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, action: 'apply_prep')
47
47
  end
48
48
 
49
- applicator = Puppet.lookup(:apply_executor) { nil }
50
- executor = Puppet.lookup(:bolt_executor) { nil }
51
- inventory = Puppet.lookup(:bolt_inventory) { nil }
52
-
53
- unless applicator && executor && inventory && Puppet.features.bolt?
54
- raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
55
- Puppet::Pops::Issues::TASK_MISSING_BOLT, action: _('apply_prep')
56
- )
57
- end
49
+ applicator = Puppet.lookup(:apply_executor)
50
+ executor = Puppet.lookup(:bolt_executor)
51
+ inventory = Puppet.lookup(:bolt_inventory)
58
52
 
59
53
  executor.report_function_call('apply_prep')
60
54
 
@@ -14,14 +14,8 @@ Puppet::Functions.create_function(:facts) do
14
14
  end
15
15
 
16
16
  def facts(target)
17
- inventory = Puppet.lookup(:bolt_inventory) { nil }
18
-
19
- unless inventory
20
- raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
21
- Puppet::Pops::Issues::TASK_MISSING_BOLT, action: _('get facts for a target')
22
- )
23
- end
24
-
17
+ inventory = Puppet.lookup(:bolt_inventory)
18
+ # Bolt executor not expected when invoked from apply block
25
19
  executor = Puppet.lookup(:bolt_executor) { nil }
26
20
  executor&.report_function_call('facts')
27
21
 
@@ -39,8 +39,8 @@ Puppet::Functions.create_function(:fail_plan) do
39
39
  .from_issue_and_stack(Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, action: 'fail_plan')
40
40
  end
41
41
 
42
- executor = Puppet.lookup(:bolt_executor) { nil }
43
- executor&.report_function_call('fail_plan')
42
+ executor = Puppet.lookup(:bolt_executor)
43
+ executor.report_function_call('fail_plan')
44
44
 
45
45
  raise Bolt::PlanFailure.new(msg, kind || 'bolt/plan-failure', details, issue_code)
46
46
  end
@@ -39,14 +39,9 @@ Puppet::Functions.create_function(:get_resources) do
39
39
  .from_issue_and_stack(Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, action: 'get_resources')
40
40
  end
41
41
 
42
- applicator = Puppet.lookup(:apply_executor) { nil }
43
- executor = Puppet.lookup(:bolt_executor) { nil }
44
- inventory = Puppet.lookup(:bolt_inventory) { nil }
45
- unless applicator && executor && inventory && Puppet.features.bolt?
46
- raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
47
- Puppet::Pops::Issues::TASK_MISSING_BOLT, action: _('get_resources')
48
- )
49
- end
42
+ applicator = Puppet.lookup(:apply_executor)
43
+ executor = Puppet.lookup(:bolt_executor)
44
+ inventory = Puppet.lookup(:bolt_inventory)
50
45
 
51
46
  resources = [resources].flatten
52
47
  resources.each do |resource|
@@ -22,14 +22,8 @@ Puppet::Functions.create_function(:get_targets) do
22
22
  end
23
23
 
24
24
  def get_targets(names)
25
- inventory = Puppet.lookup(:bolt_inventory) { nil }
26
-
27
- unless inventory && Puppet.features.bolt?
28
- raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
29
- Puppet::Pops::Issues::TASK_MISSING_BOLT, action: _('process targets through inventory')
30
- )
31
- end
32
-
25
+ inventory = Puppet.lookup(:bolt_inventory)
26
+ # Bolt executor not expected when invoked from apply block
33
27
  executor = Puppet.lookup(:bolt_executor) { nil }
34
28
  executor&.report_function_call('get_targets')
35
29
 
@@ -17,13 +17,8 @@ Puppet::Functions.create_function(:puppetdb_fact) do
17
17
  end
18
18
 
19
19
  def puppetdb_fact(certnames)
20
- puppetdb_client = Puppet.lookup(:bolt_pdb_client) { nil }
21
- unless puppetdb_client
22
- raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
23
- Puppet::Pops::Issues::TASK_MISSING_BOLT, action: _('query facts from puppetdb')
24
- )
25
- end
26
-
20
+ puppetdb_client = Puppet.lookup(:bolt_pdb_client)
21
+ # Bolt executor not expected when invoked from apply block
27
22
  executor = Puppet.lookup(:bolt_executor) { nil }
28
23
  executor&.report_function_call('puppetdb_fact')
29
24
 
@@ -19,13 +19,8 @@ Puppet::Functions.create_function(:puppetdb_query) do
19
19
  # The query type could be more specific ASTQuery = Array[Variant[String, ASTQuery]]
20
20
 
21
21
  def make_query(query)
22
- puppetdb_client = Puppet.lookup(:bolt_pdb_client) { nil }
23
- unless puppetdb_client
24
- raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
25
- Puppet::Pops::Issues::TASK_MISSING_BOLT, action: _('query facts from puppetdb')
26
- )
27
- end
28
-
22
+ puppetdb_client = Puppet.lookup(:bolt_pdb_client)
23
+ # Bolt executor not expected when invoked from apply block
29
24
  executor = Puppet.lookup(:bolt_executor) { nil }
30
25
  executor&.report_function_call('puppetdb_query')
31
26
 
@@ -49,13 +49,8 @@ Puppet::Functions.create_function(:run_command) do
49
49
 
50
50
  options ||= {}
51
51
  options = options.merge('_description' => description) if description
52
- executor = Puppet.lookup(:bolt_executor) { nil }
53
- inventory = Puppet.lookup(:bolt_inventory) { nil }
54
- unless executor && inventory && Puppet.features.bolt?
55
- raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
56
- Puppet::Pops::Issues::TASK_MISSING_BOLT, action: _('run a command')
57
- )
58
- end
52
+ executor = Puppet.lookup(:bolt_executor)
53
+ inventory = Puppet.lookup(:bolt_inventory)
59
54
 
60
55
  executor.report_function_call('run_command')
61
56
 
@@ -24,12 +24,7 @@ Puppet::Functions.create_function(:run_plan, Puppet::Functions::InternalFunction
24
24
  .from_issue_and_stack(Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, action: 'run_plan')
25
25
  end
26
26
 
27
- executor = Puppet.lookup(:bolt_executor) { nil }
28
- unless executor && Puppet.features.bolt?
29
- raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
30
- Puppet::Pops::Issues::TASK_MISSING_BOLT, action: _('run a plan')
31
- )
32
- end
27
+ executor = Puppet.lookup(:bolt_executor)
33
28
 
34
29
  # Bolt calls this function internally to trigger plans from the CLI. We
35
30
  # don't want to count those invocations.
@@ -55,13 +55,8 @@ Puppet::Functions.create_function(:run_script, Puppet::Functions::InternalFuncti
55
55
 
56
56
  options ||= {}
57
57
  options = options.merge('_description' => description) if description
58
- executor = Puppet.lookup(:bolt_executor) { nil }
59
- inventory = Puppet.lookup(:bolt_inventory) { nil }
60
- unless executor && inventory && Puppet.features.bolt?
61
- raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
62
- Puppet::Pops::Issues::TASK_MISSING_BOLT, action: _('run a script')
63
- )
64
- end
58
+ executor = Puppet.lookup(:bolt_executor)
59
+ inventory = Puppet.lookup(:bolt_inventory)
65
60
 
66
61
  executor.report_function_call('run_script')
67
62
 
@@ -32,26 +32,10 @@ Puppet::Functions.create_function(:run_task) do
32
32
  # @example Run a task
33
33
  # run_task('facts', $targets, 'Gather OS facts')
34
34
  dispatch :run_task_with_description do
35
- param 'String[1]', :task_name
36
- param 'Boltlib::TargetSpec', :targets
37
- param 'String', :description
38
- optional_param 'Hash[String[1], Any]', :task_args
39
- return_type 'ResultSet'
40
- end
41
-
42
- # Run a task, calling the block as each node starts and finishes execution. This is used from 'bolt task run'
43
- # @param task_name The task to run.
44
- # @param targets A pattern identifying zero or more targets. See {get_targets} for accepted patterns.
45
- # @param description A description to be output when calling this function.
46
- # @param task_args Arguments to the plan. Can also include additional options: '_catch_errors', '_run_as'.
47
- # @param block A block that's invoked as actions are started and finished on each node.
48
- # @return A list of results, one entry per target.
49
- dispatch :run_task_raw do
50
35
  param 'String[1]', :task_name
51
36
  param 'Boltlib::TargetSpec', :targets
52
37
  param 'Optional[String]', :description
53
38
  optional_param 'Hash[String[1], Any]', :task_args
54
- block_param 'Callable[Struct[{type => Enum[node_start, node_result], target => Target}], 1, 1]', :block
55
39
  return_type 'ResultSet'
56
40
  end
57
41
 
@@ -60,28 +44,14 @@ Puppet::Functions.create_function(:run_task) do
60
44
  end
61
45
 
62
46
  def run_task_with_description(task_name, targets, description, task_args = nil)
63
- task_args ||= {}
64
- r = run_task_raw(task_name, targets, description, task_args)
65
- if !r.ok && !task_args['_catch_errors']
66
- raise Bolt::RunFailure.new(r, 'run_task', task_name)
67
- end
68
- r
69
- end
70
-
71
- def run_task_raw(task_name, targets, description = nil, task_args = nil, &block)
72
47
  unless Puppet[:tasks]
73
48
  raise Puppet::ParseErrorWithIssue
74
49
  .from_issue_and_stack(Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, action: 'run_task')
75
50
  end
76
51
 
77
52
  task_args ||= {}
78
- executor = Puppet.lookup(:bolt_executor) { nil }
79
- inventory = Puppet.lookup(:bolt_inventory) { nil }
80
- unless executor && inventory && Puppet.features.bolt?
81
- raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
82
- Puppet::Pops::Issues::TASK_MISSING_BOLT, action: _('run a task')
83
- )
84
- end
53
+ executor = Puppet.lookup(:bolt_executor)
54
+ inventory = Puppet.lookup(:bolt_inventory)
85
55
 
86
56
  # Bolt calls this function internally to trigger tasks from the CLI. We
87
57
  # don't want to count those invocations.
@@ -149,7 +119,11 @@ Puppet::Functions.create_function(:run_task) do
149
119
  if targets.empty?
150
120
  Bolt::ResultSet.new([])
151
121
  else
152
- executor.run_task(targets, task, use_args, options, &block)
122
+ result = executor.run_task(targets, task, use_args, options)
123
+ if !result.ok && !task_args['_catch_errors']
124
+ raise Bolt::RunFailure.new(result, 'run_task', task_name)
125
+ end
126
+ result
153
127
  end
154
128
  end
155
129
 
@@ -30,16 +30,9 @@ Puppet::Functions.create_function(:set_feature) do
30
30
  .from_issue_and_stack(Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, action: 'set_feature')
31
31
  end
32
32
 
33
- inventory = Puppet.lookup(:bolt_inventory) { nil }
34
-
35
- unless inventory
36
- raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
37
- Puppet::Pops::Issues::TASK_MISSING_BOLT, action: _('set feature')
38
- )
39
- end
40
-
41
- executor = Puppet.lookup(:bolt_executor) { nil }
42
- executor&.report_function_call('set_feature')
33
+ inventory = Puppet.lookup(:bolt_inventory)
34
+ executor = Puppet.lookup(:bolt_executor)
35
+ executor.report_function_call('set_feature')
43
36
 
44
37
  inventory.set_feature(target, feature, value)
45
38
 
@@ -24,16 +24,9 @@ Puppet::Functions.create_function(:set_var) do
24
24
  .from_issue_and_stack(Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, action: 'set_var')
25
25
  end
26
26
 
27
- inventory = Puppet.lookup(:bolt_inventory) { nil }
28
-
29
- unless inventory
30
- raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
31
- Puppet::Pops::Issues::TASK_MISSING_BOLT, action: _('set a var on a target')
32
- )
33
- end
34
-
35
- executor = Puppet.lookup(:bolt_executor) { nil }
36
- executor&.report_function_call('set_var')
27
+ inventory = Puppet.lookup(:bolt_inventory)
28
+ executor = Puppet.lookup(:bolt_executor)
29
+ executor.report_function_call('set_var')
37
30
 
38
31
  inventory.set_var(target, key, value)
39
32
  end
@@ -59,13 +59,8 @@ Puppet::Functions.create_function(:upload_file, Puppet::Functions::InternalFunct
59
59
 
60
60
  options ||= {}
61
61
  options = options.merge('_description' => description) if description
62
- executor = Puppet.lookup(:bolt_executor) { nil }
63
- inventory = Puppet.lookup(:bolt_inventory) { nil }
64
- unless executor && inventory && Puppet.features.bolt?
65
- raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
66
- Puppet::Pops::Issues::TASK_MISSING_BOLT, action: _('do file uploads')
67
- )
68
- end
62
+ executor = Puppet.lookup(:bolt_executor)
63
+ inventory = Puppet.lookup(:bolt_inventory)
69
64
 
70
65
  executor.report_function_call('upload_file')
71
66
 
@@ -18,14 +18,8 @@ Puppet::Functions.create_function(:vars) do
18
18
  end
19
19
 
20
20
  def vars(target)
21
- inventory = Puppet.lookup(:bolt_inventory) { nil }
22
-
23
- unless inventory
24
- raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
25
- Puppet::Pops::Issues::TASK_MISSING_BOLT, action: _('get vars')
26
- )
27
- end
28
-
21
+ inventory = Puppet.lookup(:bolt_inventory)
22
+ # Bolt executor not expected when invoked from apply block
29
23
  executor = Puppet.lookup(:bolt_executor) { nil }
30
24
  executor&.report_function_call('vars')
31
25
 
@@ -26,13 +26,8 @@ Puppet::Functions.create_function(:wait_until_available) do
26
26
  end
27
27
 
28
28
  options ||= {}
29
- executor = Puppet.lookup(:bolt_executor) { nil }
30
- inventory = Puppet.lookup(:bolt_inventory) { nil }
31
- unless executor && inventory && Puppet.features.bolt?
32
- raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
33
- Puppet::Pops::Issues::TASK_MISSING_BOLT, action: _('wait until targets are available')
34
- )
35
- end
29
+ executor = Puppet.lookup(:bolt_executor)
30
+ inventory = Puppet.lookup(:bolt_inventory)
36
31
 
37
32
  executor.report_function_call('wait_until_available')
38
33
 
@@ -28,7 +28,7 @@ Puppet::Functions.create_function(:without_default_logging) do
28
28
  action: 'without_default_logging')
29
29
  end
30
30
 
31
- executor = Puppet.lookup(:bolt_executor) { nil }
31
+ executor = Puppet.lookup(:bolt_executor)
32
32
  executor.report_function_call('without_default_logging')
33
33
 
34
34
  executor.without_default_logging do
@@ -177,8 +177,6 @@ module Bolt
177
177
  def apply_ast(raw_ast, targets, options, plan_vars = {})
178
178
  ast = Puppet::Pops::Serialization::ToDataConverter.convert(raw_ast, rich_data: true, symbol_to_string: true)
179
179
 
180
- notify = proc { |_| nil }
181
-
182
180
  r = @executor.log_action('apply catalog', targets) do
183
181
  futures = targets.map do |target|
184
182
  Concurrent::Future.execute(executor: @pool) do
@@ -200,7 +198,13 @@ module Bolt
200
198
  '_noop' => options['_noop']
201
199
  }
202
200
 
203
- results = transport.batch_task(batch, catalog_apply_task, arguments, options, &notify)
201
+ callback = proc do |event|
202
+ if event[:type] == :node_result
203
+ event = event.merge(result: ApplyResult.from_task_result(event[:result]))
204
+ end
205
+ @executor.publish_event(event)
206
+ end
207
+ results = transport.batch_task(batch, catalog_apply_task, arguments, options, &callback)
204
208
  Array(results).map { |result| ApplyResult.from_task_result(result) }
205
209
  end
206
210
  end