bolt 1.38.0 → 1.39.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.
- checksums.yaml +4 -4
- data/bolt-modules/boltlib/lib/puppet/functions/resolve_references.rb +3 -0
- data/bolt-modules/boltlib/lib/puppet/functions/run_task.rb +5 -2
- data/lib/bolt/applicator.rb +1 -1
- data/lib/bolt/cli.rb +4 -1
- data/lib/bolt/inventory/group2.rb +10 -1
- data/lib/bolt/inventory/inventory2.rb +8 -6
- data/lib/bolt/outputter/human.rb +1 -0
- data/lib/bolt/plugin.rb +1 -1
- data/lib/bolt/task.rb +6 -0
- data/lib/bolt/version.rb +1 -1
- 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: 99b27a1cfbd744e85a99efe9c4785b4ab3a15e9a6fe15af9ac0496bd463736c7
|
4
|
+
data.tar.gz: 530cbd2525700cdaebf9920aebf1ea3b104a2867dfb030a695e0046e162152a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf7e5a175d04bf27ad2e2e0b4e464f334be20e4d08e9f0d072a51da695eb00698623eada2153865ec68fe125ace42e4c4939a5ef24513ec9139b1d87d302a6b0
|
7
|
+
data.tar.gz: fedbec2378ba33c83b3cbbb1fce8e3a610c2dbbe66c200ddc72f2e6728b49a2f38a7f60ecebbc4ebb0959227d4402175108ad0da5d15220b3ddc91b52d5ae725
|
@@ -32,6 +32,9 @@ Puppet::Functions.create_function(:resolve_references) do
|
|
32
32
|
)
|
33
33
|
end
|
34
34
|
|
35
|
+
executor = Puppet.lookup(:bolt_executor)
|
36
|
+
executor.report_function_call(self.class.name)
|
37
|
+
|
35
38
|
plugins = Puppet.lookup(:bolt_inventory).plugins
|
36
39
|
plugins.resolve_references(references)
|
37
40
|
end
|
@@ -80,11 +80,14 @@ Puppet::Functions.create_function(:run_task) do
|
|
80
80
|
raise Bolt::Error.unknown_task(task_name)
|
81
81
|
end
|
82
82
|
|
83
|
+
task = Bolt::Task.new(task_signature.task_hash)
|
84
|
+
|
85
|
+
# Set the default value for any params that have one and were not provided
|
86
|
+
params = task.parameter_defaults.merge(params)
|
87
|
+
|
83
88
|
task_signature.runnable_with?(params) do |mismatch_message|
|
84
89
|
raise with_stack(:TYPE_MISMATCH, mismatch_message)
|
85
90
|
end || (raise with_stack(:TYPE_MISMATCH, 'Task parameters do not match'))
|
86
|
-
|
87
|
-
task = Bolt::Task.new(task_signature.task_hash)
|
88
91
|
end
|
89
92
|
|
90
93
|
unless Puppet::Pops::Types::TypeFactory.data.instance?(params)
|
data/lib/bolt/applicator.rb
CHANGED
@@ -156,7 +156,7 @@ module Bolt
|
|
156
156
|
end
|
157
157
|
|
158
158
|
# collect plan vars and merge them over target vars
|
159
|
-
plan_vars = scope.to_hash
|
159
|
+
plan_vars = scope.to_hash(true, true)
|
160
160
|
%w[trusted server_facts facts].each { |k| plan_vars.delete(k) }
|
161
161
|
|
162
162
|
targets = @inventory.get_targets(args[0])
|
data/lib/bolt/cli.rb
CHANGED
@@ -99,9 +99,12 @@ module Bolt
|
|
99
99
|
"option or param=value pairs, not both"
|
100
100
|
end
|
101
101
|
options[:params_parsed] = true
|
102
|
-
|
102
|
+
elsif task_options.any?
|
103
103
|
options[:params_parsed] = false
|
104
104
|
options[:task_options] = Hash[task_options.map { |a| a.split('=', 2) }]
|
105
|
+
else
|
106
|
+
options[:params_parsed] = true
|
107
|
+
options[:task_options] = {}
|
105
108
|
end
|
106
109
|
end
|
107
110
|
options[:leftovers] = remaining
|
@@ -108,6 +108,10 @@ module Bolt
|
|
108
108
|
raise ValidationError.new("No name or uri for target: #{target}", @name)
|
109
109
|
end
|
110
110
|
|
111
|
+
unless t_name.is_a? String
|
112
|
+
raise ValidationError.new("Target name must be a String, not #{t_name.class}", @name)
|
113
|
+
end
|
114
|
+
|
111
115
|
unless t_name.ascii_only?
|
112
116
|
raise ValidationError.new("Target name must be ASCII characters: #{target}", @name)
|
113
117
|
end
|
@@ -153,6 +157,10 @@ module Bolt
|
|
153
157
|
end
|
154
158
|
end
|
155
159
|
|
160
|
+
def clear_alia(target_name)
|
161
|
+
@aliases.reject! { |_alias, name| name == target_name }
|
162
|
+
end
|
163
|
+
|
156
164
|
def data_merge(data1, data2)
|
157
165
|
if data2.nil? || data1.nil?
|
158
166
|
return data2 || data1
|
@@ -162,7 +170,8 @@ module Bolt
|
|
162
170
|
'config' => Bolt::Util.deep_merge(data1['config'], data2['config']),
|
163
171
|
'name' => data1['name'] || data2['name'],
|
164
172
|
'uri' => data1['uri'] || data2['uri'],
|
165
|
-
|
173
|
+
# Collect all aliases across all groups for each target uri
|
174
|
+
'alias' => [*data1['alias'], *data2['alias']],
|
166
175
|
# Shallow merge instead of deep merge so that vars with a hash value
|
167
176
|
# are assigned a new hash, rather than merging the existing value
|
168
177
|
# with the value meant to replace it
|
@@ -173,10 +173,12 @@ module Bolt
|
|
173
173
|
existing_target = @targets.key?(new_target.name)
|
174
174
|
@targets[new_target.name] = new_target
|
175
175
|
|
176
|
-
|
176
|
+
if existing_target
|
177
|
+
clear_alia_from_group(@groups, new_target.name)
|
178
|
+
else
|
177
179
|
add_to_group([new_target], 'all')
|
178
180
|
end
|
179
|
-
|
181
|
+
|
180
182
|
if (aliases = new_target.target_alias)
|
181
183
|
aliases = [aliases] if aliases.is_a?(String)
|
182
184
|
unless aliases.is_a?(Array)
|
@@ -184,18 +186,18 @@ module Bolt
|
|
184
186
|
raise ValidationError.new(msg, @name)
|
185
187
|
end
|
186
188
|
|
187
|
-
|
189
|
+
@groups.insert_alia(new_target.name, aliases)
|
188
190
|
end
|
189
191
|
|
190
192
|
new_target
|
191
193
|
end
|
192
194
|
|
193
|
-
def
|
195
|
+
def clear_alia_from_group(group, target_name)
|
194
196
|
if group.all_target_names.include?(target_name)
|
195
|
-
group.
|
197
|
+
group.clear_alia(target_name)
|
196
198
|
end
|
197
199
|
group.groups.each do |grp|
|
198
|
-
|
200
|
+
clear_alia_from_group(grp, target_name)
|
199
201
|
end
|
200
202
|
end
|
201
203
|
|
data/lib/bolt/outputter/human.rb
CHANGED
@@ -223,6 +223,7 @@ module Bolt
|
|
223
223
|
|
224
224
|
task['metadata']['parameters']&.each do |k, v|
|
225
225
|
pretty_params << "- #{k}: #{v['type'] || 'Any'}\n"
|
226
|
+
pretty_params << " Default: #{v['default'].inspect}\n" if v.key?('default')
|
226
227
|
pretty_params << " #{v['description']}\n" if v['description']
|
227
228
|
usage << if v['type'].is_a?(Puppet::Pops::Types::POptionalType)
|
228
229
|
" [#{k}=<value>]"
|
data/lib/bolt/plugin.rb
CHANGED
@@ -51,7 +51,7 @@ module Bolt
|
|
51
51
|
private :serial_executor
|
52
52
|
|
53
53
|
def empty_inventory
|
54
|
-
@empty_inventory ||= Bolt::Inventory::Inventory2.new({},
|
54
|
+
@empty_inventory ||= Bolt::Inventory::Inventory2.new({}, plugins: @plugins)
|
55
55
|
end
|
56
56
|
private :empty_inventory
|
57
57
|
|
data/lib/bolt/task.rb
CHANGED
@@ -42,6 +42,12 @@ module Bolt
|
|
42
42
|
metadata['parameters']
|
43
43
|
end
|
44
44
|
|
45
|
+
def parameter_defaults
|
46
|
+
(parameters || {}).each_with_object({}) do |(name, param_spec), defaults|
|
47
|
+
defaults[name] = param_spec['default'] if param_spec.key?('default')
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
45
51
|
def supports_noop
|
46
52
|
metadata['supports_noop']
|
47
53
|
end
|
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: 1.
|
4
|
+
version: 1.39.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -156,7 +156,7 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - ">="
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 6.
|
159
|
+
version: 6.11.0
|
160
160
|
- - "<"
|
161
161
|
- !ruby/object:Gem::Version
|
162
162
|
version: '7'
|
@@ -166,7 +166,7 @@ dependencies:
|
|
166
166
|
requirements:
|
167
167
|
- - ">="
|
168
168
|
- !ruby/object:Gem::Version
|
169
|
-
version: 6.
|
169
|
+
version: 6.11.0
|
170
170
|
- - "<"
|
171
171
|
- !ruby/object:Gem::Version
|
172
172
|
version: '7'
|