From 35ebb94ea2f6778c8637f66aa2c0ddb21fb6cc2a Mon Sep 17 00:00:00 2001 From: keboliu Date: Thu, 4 Jul 2019 13:19:31 +0300 Subject: [PATCH] enhance the judge condition for speed_index --- ansible/library/port_alias.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/library/port_alias.py b/ansible/library/port_alias.py index f532a16ce2f..289d00de0f1 100755 --- a/ansible/library/port_alias.py +++ b/ansible/library/port_alias.py @@ -112,7 +112,7 @@ def get_portmap(self): aliases.append(alias) portmap[name] = alias aliasmap[alias] = name - if speed_index != -1: + if (speed_index != -1) and (len(mapping) > speed_index): portspeed[alias] = mapping[speed_index] return (aliases, portmap, aliasmap, portspeed)