Commit d449c731 authored by Simon Delamare's avatar Simon Delamare
Browse files

[lib] Avoid reference-api to crash if snmp_pattern is missing from a net. equipment

parent 5c51c2c1
Pipeline #185114 passed with stages
in 8 minutes and 39 seconds
......@@ -24,7 +24,7 @@ def net_switch_port_lookup(site, node_uid, interface='')
if switch_remote_uid == node_uid and switch_remote_port == interface
# Build port name from snmp_naming_pattern
# Example: '3 2 GigabitEthernet%LINECARD%/%PORT%' -> 'GigabitEthernet3/2'
pattern = port["snmp_pattern"] || lc["snmp_pattern"]
pattern = port["snmp_pattern"] || lc["snmp_pattern"] || ""
port_name = pattern.sub("%LINECARD%",lc_uid.to_s).sub("%PORT%",port_uid.to_s)
return switch_uid, port_name
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment