Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
grid5000
reference-repository
Commits
d449c731
Commit
d449c731
authored
Nov 09, 2020
by
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
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/refrepo/gen/reference-api.rb
View file @
d449c731
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment