fix ethtool class in case ethtool works but returns nothing (#123)
This commit is contained in:
parent
a42cf2eb48
commit
312f472e9c
1 changed files with 5 additions and 5 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue