Skip to content

Commit

Permalink
[lib] Fix in kwollector generator to not crash if a pdu has no ports
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDelamare committed Feb 14, 2022
1 parent c17cd03 commit 9030d54
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/refrepo/gen/puppet/kwollectg5k.rb
Expand Up @@ -62,7 +62,7 @@ def generate_puppet_kwollectg5k(options)
pdu.fetch('metrics', []).each {|metric|
next if metric['source']['protocol'] != 'snmp'
if metric['source']['id'].include?('%PORT%')
pdu['ports'].each {|port_uid, node_uid|
pdu.fetch('ports', {}).each {|port_uid, node_uid|
if not ports_by_node.has_key?(node_uid)
ports_by_node[node_uid] = []
end
Expand Down
2 changes: 1 addition & 1 deletion lib/refrepo/gen/puppet/templates/kwollect-pdu.erb
Expand Up @@ -7,7 +7,7 @@
pdu.fetch('metrics', []).each {|metric|
next if metric['source']['protocol'] != 'snmp'
if metric['source']['id'].include?('%PORT%')
pdu['ports'].each {|port_uid, node_uid|
pdu.fetch('ports', {}).each {|port_uid, node_uid|
# Map metric to node only for single PSU
single_port = ports_by_node[node_uid].length == 1
-%>
Expand Down

0 comments on commit 9030d54

Please sign in to comment.