summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--python/vyos/ifconfig/ethernet.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/python/vyos/ifconfig/ethernet.py b/python/vyos/ifconfig/ethernet.py
index 7cf79bead..795218f32 100644
--- a/python/vyos/ifconfig/ethernet.py
+++ b/python/vyos/ifconfig/ethernet.py
@@ -118,9 +118,10 @@ class EthernetIf(Interface):
if enable not in ['on', 'off']:
raise ValueError("Value out of range")
- if self.get_driver_name() in ['vmxnet3', 'virtio_net', 'xen_netfront']:
- self._debug_msg('{} driver does not support changing flow control settings!'
- .format(self.get_driver_name()))
+ driver_name = self.get_driver_name()
+ if driver_name in ['vmxnet3', 'virtio_net', 'xen_netfront']:
+ self._debug_msg(f'{driver_name} driver does not support changing '\
+ 'flow control settings!')
return
# Get current flow control settings:
@@ -169,15 +170,17 @@ class EthernetIf(Interface):
>>> i.set_speed_duplex('auto', 'auto')
"""
- if speed not in ['auto', '10', '100', '1000', '2500', '5000', '10000', '25000', '40000', '50000', '100000', '400000']:
+ if speed not in ['auto', '10', '100', '1000', '2500', '5000', '10000',
+ '25000', '40000', '50000', '100000', '400000']:
raise ValueError("Value out of range (speed)")
if duplex not in ['auto', 'full', 'half']:
raise ValueError("Value out of range (duplex)")
- if self.get_driver_name() in ['vmxnet3', 'virtio_net', 'xen_netfront']:
- self._debug_msg('{} driver does not support changing speed/duplex settings!'
- .format(self.get_driver_name()))
+ driver_name = self.get_driver_name()
+ if driver_name in ['vmxnet3', 'virtio_net', 'xen_netfront']:
+ self._debug_msg(f'{driver_name} driver does not support changing '\
+ 'speed/duplex settings!')
return
# Get current speed and duplex settings: