mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
ifupdownaddons: mstpctlutils: cache empty 'showportdetail' results
mstpctl might return an empty result on: mstpctl showportdetail bridge json the cache is not filled with an empty dict so next cache lookup will be a cache miss and therefore, ifupdown2 thinks we need to fill the cache with fresh data and will execute showportdetail again (resulting in calling mstpctl cmd sometime 5 or 6 times in a row). Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
This commit is contained in:
@@ -79,8 +79,8 @@ class mstpctlutil(utilsBase):
|
||||
return mstpctlutil._DEFAULT_PORT_PRIO
|
||||
|
||||
def _get_bridge_and_port_attrs_from_cache(self, bridgename):
|
||||
attrs = MSTPAttrsCache.get(bridgename)
|
||||
if attrs:
|
||||
attrs = MSTPAttrsCache.get(bridgename, None)
|
||||
if attrs is not None:
|
||||
return attrs
|
||||
mstpctl_bridgeport_attrs_dict = {}
|
||||
try:
|
||||
@@ -88,6 +88,7 @@ class mstpctlutil(utilsBase):
|
||||
'showportdetail', bridgename, 'json']
|
||||
output = utils.exec_commandl(cmd)
|
||||
if not output:
|
||||
MSTPAttrsCache.set(bridgename, mstpctl_bridgeport_attrs_dict)
|
||||
return mstpctl_bridgeport_attrs_dict
|
||||
except Exception as e:
|
||||
self.logger.info(str(e))
|
||||
|
Reference in New Issue
Block a user