mirror of
https://github.com/linux-system-roles/network.git
synced 2026-07-21 10:18:27 +00:00
library: ignore failure of ethtool to get permanent MAC address
It's not uncommon that ethtool fails with: # ethtool -P dummy0 Cannot read permanent address: Operation not supported Ignore such errors.
This commit is contained in:
parent
3225b3a89d
commit
2cd6d3dbdf
1 changed files with 4 additions and 1 deletions
|
|
@ -316,7 +316,10 @@ class SysUtil:
|
|||
|
||||
@staticmethod
|
||||
def _link_read_permaddress(ifname):
|
||||
out = Util.check_output(['ethtool', '-P', ifname])
|
||||
try:
|
||||
out = Util.check_output(['ethtool', '-P', ifname])
|
||||
except MyError as e:
|
||||
return None
|
||||
import re
|
||||
m = re.match('^Permanent address: ([0-9A-Fa-f:]*)\n$', out)
|
||||
if not m:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue