From 15bb78054f29ed9957e468d166c49110a0c4ef79 Mon Sep 17 00:00:00 2001 From: Roopa Prabhu Date: Fri, 26 Feb 2016 15:32:18 -0800 Subject: [PATCH] mstpctlutil: fix strip on NoneType warning saw this during execution of the below command: ifup --no-act -a Signed-off-by: Roopa Prabhu --- ifupdownaddons/mstpctlutil.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ifupdownaddons/mstpctlutil.py b/ifupdownaddons/mstpctlutil.py index ff2f179..75a1f51 100644 --- a/ifupdownaddons/mstpctlutil.py +++ b/ifupdownaddons/mstpctlutil.py @@ -74,10 +74,14 @@ class mstpctlutil(utilsBase): ''' self.mstpctl_bridgeport_attrs_dict = {} self.mstpctl_bridgeport_attrs_dict[bridgename] = {} - showall_output = self.subprocess_check_output(['/sbin/mstpctl', - 'showportdetail', bridgename, 'json']).strip('\n') - if showall_output == None or showall_output == '': + try: + showall_output = self.subprocess_check_output(['/sbin/mstpctl', + 'showportdetail', bridgename, 'json']) + except: + pass + if not showall_output or showall_output == '': return + showall_output = showall_output.strip('\n') mstpctl_bridge_cache = json.loads(showall_output) for portname in mstpctl_bridge_cache.keys(): # we will ignore the portid for now and just index