Skip to content

Commit 39a9b03

Browse files
author
jordanbreen28
committed
(CONT-1193) - Fix bug with broken describe providers command
This commit introduces a fix that now allows the describe providers command to work. It also adds a null check before executing `each` on the describe_types variable as before this would result in unknown function each for Nil:Nil Class.
1 parent 8d24a05 commit 39a9b03

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/puppet-strings/describe.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,18 @@ module PuppetStrings::Describe
1313
def self.render(describe_types = [], list = false, _providers = false)
1414
document = {
1515
defined_types: YARD::Registry.all(:puppet_defined_type).sort_by!(&:name).map!(&:to_hash),
16-
resource_types: YARD::Registry.all(:puppet_type).sort_by!(&:name).map!(&:to_hash)
16+
resource_types: YARD::Registry.all(:puppet_type).sort_by!(&:name).map!(&:to_hash),
17+
providers: YARD::Registry.all(:puppet_provider).sort_by!(&:name).map!(&:to_hash)
1718
}
1819

1920
if list
2021
puts 'These are the types known to puppet:'
2122
document[:resource_types].each { |t| list_one_type(t) }
2223
else
23-
document[:providers] = YARD::Registry.all(:puppet_provider).sort_by!(&:name).map!(&:to_hash)
24+
document[:providers].each { |p| list_one_type(p) }
2425

2526
type_names = {}
26-
describe_types.each { |name| type_names[name] = true }
27+
describe_types&.each { |name| type_names[name] = true }
2728

2829
document[:resource_types].each do |t|
2930
show_one_type(t) if type_names[t[:name].to_s]

0 commit comments

Comments
 (0)