bolt 3.25.0 → 3.26.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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe3e07dae1f3e80d3b4ade7c9d78749f54c592e246b2fd82e6264ab908b8baa1
4
- data.tar.gz: 44af49cb408f92496c9795d892bc2e43e04788dd6ead42070a04e258958f00ac
3
+ metadata.gz: '0591d13a9aa93f3c96585985ffdf1619c29f3f13130cbde98e1b24a1a357b84b'
4
+ data.tar.gz: 3fe46914478ad07fab90348eb0464a5e45f5c10fa5f921baf3fa089f8d17cad3
5
5
  SHA512:
6
- metadata.gz: 0d158d8a0d8c72c99a34464ad4de0df9e7b04a83b1509b048c5b650baccbea9a06f99dfd512bfc8bdc91f5065e22148b76814a895766717bfe9f2c34bd81e55f
7
- data.tar.gz: eca8af5592551ff9a273ad508831f9a1e07edf0327aa29dcc7078e5fb44743033c92388d79ab22ae2d3c5ea9574984b0c50849544159ab8dd32c2090a0dad939
6
+ metadata.gz: a12e686a2ce4a3a15f22e2d45f8210eb6211c910e49e59377e37165554ae5f776c4827dfdb93984d8acdd6295cb7c31f49a090a4239ecc2150bff27f2aeb2bbc
7
+ data.tar.gz: 5f6ccddd83c3026b1a34be7ab439d800f82cb997f179ab9967ead53c87b5141f2419dce5ae0a29ad17fc4257b294856e39aa61916fca4cbb907919520ad8fbf3
@@ -125,16 +125,25 @@ module Bolt
125
125
  end
126
126
 
127
127
  # If target is a group name, expand it to the members of that group.
128
- # Else match against targets in inventory by name or alias.
128
+ # Else match against groups and targets in inventory by name or alias.
129
129
  # If a wildcard string, error if no matches are found.
130
130
  # Else fall back to [target] if no matches are found.
131
131
  def resolve_name(target, ext_glob: false)
132
132
  if (group = group_lookup[target])
133
- group.all_targets
133
+ group.all_targets.to_a
134
134
  else
135
- # Try to wildcard match targets in inventory
136
- # Ignore case because hostnames are generally case-insensitive
137
- targets = groups.all_targets.select { |targ| match_wildcard?(target, targ, ext_glob: ext_glob) }
135
+ targets = []
136
+
137
+ # Find groups that match the glob
138
+ group_lookup.each do |name, grp|
139
+ next unless match_wildcard?(target, name, ext_glob: ext_glob)
140
+ targets += grp.all_targets.to_a
141
+ end
142
+
143
+ # Find target names that match the glob
144
+ targets += groups.all_targets.select { |targ| match_wildcard?(target, targ, ext_glob: ext_glob) }
145
+
146
+ # Find target aliases that match the glob
138
147
  targets += groups.target_aliases
139
148
  .select { |tgt_alias, _| match_wildcard?(target, tgt_alias, ext_glob: ext_glob) }
140
149
  .values
@@ -143,7 +152,7 @@ module Bolt
143
152
  raise(WildcardError, target) if target.include?('*')
144
153
  [target]
145
154
  else
146
- targets
155
+ targets.uniq
147
156
  end
148
157
  end
149
158
  end
@@ -194,7 +194,7 @@ module Bolt
194
194
  end
195
195
  end
196
196
  when 'lookup'
197
- @stream.puts(indent(2, result['value']))
197
+ @stream.puts(indent(2, Bolt::Util::Format.stringify(result['value'])))
198
198
  else
199
199
  if result.generic_value.any?
200
200
  @stream.puts(indent(2, ::JSON.pretty_generate(result.generic_value)))
@@ -363,7 +363,7 @@ module Bolt
363
363
  end
364
364
  usage << (Bolt::Util.powershell? ? ' [-Noop]' : ' [--noop]') if task.supports_noop
365
365
  params.each do |name, data|
366
- usage << if data['type']&.start_with?('Optional')
366
+ usage << if data['type']&.start_with?('Optional') || data.key?('default')
367
367
  " [#{name}=<value>]"
368
368
  else
369
369
  " #{name}=<value>"
@@ -79,8 +79,9 @@ module Bolt
79
79
 
80
80
  Bolt::Util.walk_vals(template) do |value|
81
81
  # This is done in parts instead of in place so that we only need to
82
- # make one puppetDB query
83
- if value.is_a?(String)
82
+ # make one puppetDB query. Don't gather certname since we already
83
+ # have that and it's not a fact.
84
+ if value.is_a?(String) && value != 'certname'
84
85
  facts << fact_path(value)
85
86
  end
86
87
  value
@@ -110,11 +110,11 @@ module Bolt
110
110
  return {} if certnames.empty? || facts.empty?
111
111
 
112
112
  certnames.uniq!
113
- name_query = certnames.map { |c| ["=", "certname", c] }
114
- name_query.insert(0, "or")
113
+ name_query = certnames.each_slice(100).map { |slice| ["in", "certname", ["array", slice]] }
114
+ name_query.unshift("or")
115
115
 
116
116
  facts_query = facts.map { |f| ["=", "path", f] }
117
- facts_query.insert(0, "or")
117
+ facts_query.unshift("or")
118
118
 
119
119
  query = ['and', name_query, facts_query]
120
120
 
data/lib/bolt/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bolt
4
- VERSION = '3.25.0'
4
+ VERSION = '3.26.1'
5
5
  end
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.25.0
4
+ version: 3.26.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-27 00:00:00.000000000 Z
11
+ date: 2022-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable