bolt 0.21.6 → 0.21.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of bolt might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/bolt-modules/boltlib/lib/puppet/functions/run_plan.rb +28 -24
- data/lib/bolt/executor.rb +16 -0
- data/lib/bolt/puppetdb/config.rb +1 -0
- data/lib/bolt/version.rb +1 -1
- data/lib/bolt_spec/plans/mock_executor.rb +4 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af8e2b6778a6eefcb1efcafe215e6d0642cc1f1d59b656d12bf94d66e6136c73
|
4
|
+
data.tar.gz: 36cfe00c4670dec416489ab9212928071037fd5010e381d2aab07a5fd6914b81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0f08cc1c6b9f3b407c0b292e842ae4b5e21f41857c78a768b7a965877d22cff0affe9a878ebb1c551a7fb81b05d9548d056ea172e1e8e1d6204b85a8f6ccf22
|
7
|
+
data.tar.gz: c68bd35efb219e3d836e5e77e497708b1c5b8a05c1a6dcdc0025d38a754fce5fd334a3f26e989e4f0bf2131a3df82a0bbbbc5b7a74247fdf262c5bd66563f050
|
@@ -53,36 +53,40 @@ Puppet::Functions.create_function(:run_plan, Puppet::Functions::InternalFunction
|
|
53
53
|
)
|
54
54
|
end
|
55
55
|
|
56
|
-
# TODO: Add profiling around this
|
57
56
|
if (run_as = named_args['_run_as'])
|
58
57
|
old_run_as = executor.run_as
|
59
58
|
executor.run_as = run_as
|
60
59
|
end
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
nil
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
60
|
+
|
61
|
+
# wrap plan execution in logging messages
|
62
|
+
executor.log_plan(plan_name) do
|
63
|
+
result = nil
|
64
|
+
begin
|
65
|
+
# If the plan does not throw :return by calling the return function it's result is
|
66
|
+
# undef/nil
|
67
|
+
result = catch(:return) do
|
68
|
+
func.class.dispatcher.dispatchers[0].call_by_name_with_scope(scope, params, true)
|
69
|
+
nil
|
70
|
+
end&.value
|
71
|
+
# Validate the result is a PlanResult
|
72
|
+
unless Puppet::Pops::Types::TypeParser.singleton.parse('Boltlib::PlanResult').instance?(result)
|
73
|
+
raise Bolt::InvalidPlanResult.new(plan_name, result.to_s)
|
74
|
+
end
|
75
|
+
|
76
|
+
result
|
77
|
+
rescue Puppet::PreformattedError => err
|
78
|
+
if named_args['_catch_errors'] && err.cause.is_a?(Bolt::Error)
|
79
|
+
result = err.cause.to_puppet_error
|
80
|
+
else
|
81
|
+
raise err
|
82
|
+
end
|
83
|
+
ensure
|
84
|
+
if run_as
|
85
|
+
executor.run_as = old_run_as
|
86
|
+
end
|
72
87
|
end
|
88
|
+
|
73
89
|
result
|
74
|
-
rescue Puppet::PreformattedError => err
|
75
|
-
if named_args['_catch_errors'] && err.cause.is_a?(Bolt::Error)
|
76
|
-
result = err.cause.to_puppet_error
|
77
|
-
else
|
78
|
-
raise err
|
79
|
-
end
|
80
|
-
ensure
|
81
|
-
if run_as
|
82
|
-
executor.run_as = old_run_as
|
83
|
-
end
|
84
90
|
end
|
85
|
-
|
86
|
-
result
|
87
91
|
end
|
88
92
|
end
|
data/lib/bolt/executor.rb
CHANGED
@@ -134,6 +134,22 @@ module Bolt
|
|
134
134
|
results
|
135
135
|
end
|
136
136
|
|
137
|
+
def log_plan(plan_name)
|
138
|
+
log_method = @plan_logging ? :notice : :info
|
139
|
+
@logger.send(log_method, "Starting: plan #{plan_name}")
|
140
|
+
start_time = Time.now
|
141
|
+
|
142
|
+
results = nil
|
143
|
+
begin
|
144
|
+
results = yield
|
145
|
+
ensure
|
146
|
+
duration = Time.now - start_time
|
147
|
+
@logger.send(log_method, "Finished: plan #{plan_name} in #{duration.round(2)} sec")
|
148
|
+
end
|
149
|
+
|
150
|
+
results
|
151
|
+
end
|
152
|
+
|
137
153
|
def report_transport(transport, count)
|
138
154
|
name = transport.class.name.split('::').last.downcase
|
139
155
|
@analytics&.event('Transport', 'initialize', name, count) unless @reported_transports.include?(name)
|
data/lib/bolt/puppetdb/config.rb
CHANGED
data/lib/bolt/version.rb
CHANGED
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: 0.21.
|
4
|
+
version: 0.21.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 0.3.1
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 0.3.1
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: r10k
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|