mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
ifupdownaddons: mstpctlutil: fixing 'UnboundLocalError: local variable referenced before assignment'. Also, now catching subprocess.CalledProcessError exception and general Exception.
Ticket: None Reviewed By: Roopa Testing Done: ifreload -a (vxlan interface file)
This commit is contained in:
@@ -77,8 +77,9 @@ class mstpctlutil(utilsBase):
|
||||
try:
|
||||
showall_output = self.subprocess_check_output(['/sbin/mstpctl',
|
||||
'showportdetail', bridgename, 'json'])
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.logger.warn(str(e))
|
||||
return
|
||||
if not showall_output or showall_output == '':
|
||||
return
|
||||
showall_output = showall_output.strip('\n')
|
||||
|
@@ -99,9 +99,12 @@ class utilsBase(object):
|
||||
return
|
||||
try:
|
||||
return subprocess.check_output(cmdl, stderr=subprocess.STDOUT)
|
||||
except Exception, e:
|
||||
except subprocess.CalledProcessError as e:
|
||||
raise Exception('failed to execute cmd \'%s\' (%s)'
|
||||
%(' '.join(cmdl), e.output))
|
||||
except Exception as e:
|
||||
raise Exception('failed to execute cmd \'%s\' (%s)'
|
||||
%(' '.join(cmdl), str(e)))
|
||||
|
||||
def subprocess_check_call(self, cmdl):
|
||||
""" subprocess check_call implementation using popen
|
||||
|
Reference in New Issue
Block a user