]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
ifupdownaddons: mstpctlutil: fixing 'UnboundLocalError: local variable referenced...
authorJulien Fortin <julien@cumulusnetworks.com>
Tue, 19 Apr 2016 00:36:15 +0000 (02:36 +0200)
committerJulien Fortin <julien@cumulusnetworks.com>
Tue, 19 Apr 2016 00:36:15 +0000 (02:36 +0200)
Ticket: None
Reviewed By: Roopa
Testing Done: ifreload -a (vxlan interface file)

ifupdownaddons/mstpctlutil.py
ifupdownaddons/utilsbase.py

index 75a1f51290abcbafde185e8af41debcb8925f41a..9695b700457e2ea8bbc73a4b950abb3d15c18c3d 100644 (file)
@@ -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')
index f0a4ca61604ce280ad8db23b8d386873c95dc443..a490c8f8c0df9790672110036b98369775c1f9c3 100644 (file)
@@ -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