Mentions légales du service

Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
Pipeline #185114 passed
...@@ -24,7 +24,7 @@ def net_switch_port_lookup(site, node_uid, interface='') ...@@ -24,7 +24,7 @@ def net_switch_port_lookup(site, node_uid, interface='')
if switch_remote_uid == node_uid and switch_remote_port == interface if switch_remote_uid == node_uid and switch_remote_port == interface
# Build port name from snmp_naming_pattern # Build port name from snmp_naming_pattern
# Example: '3 2 GigabitEthernet%LINECARD%/%PORT%' -> 'GigabitEthernet3/2' # 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) port_name = pattern.sub("%LINECARD%",lc_uid.to_s).sub("%PORT%",port_uid.to_s)
return switch_uid, port_name return switch_uid, port_name
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment