fix ethtool class in case ethtool works but returns nothing #123

Merged
Solvik merged 1 commit from fix_ethtool into master 2020-04-19 12:19:29 +02:00

View file

@ -65,11 +65,11 @@ class Ethtool():
def _parse_ethtool_module_output(self):
status, output = subprocess.getstatusoutput('ethtool -m {}'.format(self.interface))
if status != 0:
return {}
r = re.search(r'Identifier.*\((\w+)\)', output)
if r and len(r.groups()) > 0:
return {'form_factor': r.groups()[0]}
if status == 0:
r = re.search(r'Identifier.*\((\w+)\)', output)
if r and len(r.groups()) > 0:
return {'form_factor': r.groups()[0]}
return {}
def parse(self):
if which('ethtool') is None: