Commit 7bb86f48 authored by Nigel Kukard's avatar Nigel Kukard
Browse files

Cleaned up f-string usage

parent 93958131
......@@ -649,7 +649,7 @@ class Ili:
while install_microcode is None:
# Display a radiolist with the network addressing types
code, install_microcode = self._dialog.radiolist(
f'Install CPU microcode updates?',
'Install CPU microcode updates?',
height=20, width=50, list_height=10,
title='Install Microcode',
choices=[
......
......@@ -87,20 +87,20 @@ class ConfigSystemdNetworkd(Plugin):
for device_name, device_mac in ili_state.network_interface_mappings.items():
# Open the hardware address file
with open(f'{ili_state.target_root}/etc/systemd/network/10-{device_name}.link', 'w') as link_file:
link_file.write(f'# Created during install\n')
link_file.write(f'[Match]\n')
link_file.write(f'Path=pci-*\n')
link_file.write('# Created during install\n')
link_file.write('[Match]\n')
link_file.write('Path=pci-*\n')
link_file.write(f'MACAddress={device_mac}\n')
link_file.write('\n')
link_file.write(f'[Link]\n')
link_file.write('[Link]\n')
link_file.write(f'Name={device_name}\n')
link_file.close()
def _write_network_file(self, ili_state: IliState, device_name: str, config: Dict[str, str]):
# Open the hardware address file
with open(f'{ili_state.target_root}/etc/systemd/network/50-{device_name}.network', 'w') as network_file:
network_file.write(f'# Created during install\n')
network_file.write(f'[Match]\n')
network_file.write('# Created during install\n')
network_file.write('[Match]\n')
network_file.write(f'Name={device_name}\n')
network_file.write('\n')
......@@ -108,28 +108,28 @@ class ConfigSystemdNetworkd(Plugin):
# Check if this interface uses DHCP
if 'dhcp' in config:
network_file.write(f'DHCP=yes\n')
network_file.write('DHCP=yes\n')
else:
network_file.write(f'ConfigureWithoutCarrier=yes\n')
network_file.write(f'IgnoreCarrierLoss=yes\n')
network_file.write('ConfigureWithoutCarrier=yes\n')
network_file.write('IgnoreCarrierLoss=yes\n')
# Check if we have IP addresses
if 'ipv4address' in config:
network_file.write(f'Address=%s\n' % config['ipv4address'])
network_file.write('Address=%s\n' % config['ipv4address'])
if 'ipv6address' in config:
network_file.write(f'Address=%s\n' % config['ipv6address'])
network_file.write('Address=%s\n' % config['ipv6address'])
# Check if we have gateways
if 'ipv4gateway' in config:
network_file.write(f'Gateway=%s\n' % config['ipv4gateway'])
network_file.write('Gateway=%s\n' % config['ipv4gateway'])
if 'ipv6gateway' in config:
network_file.write(f'Gateway=%s\n' % config['ipv6gateway'])
network_file.write('Gateway=%s\n' % config['ipv6gateway'])
# Check if we have DNS servers
if 'dns1address' in config:
network_file.write(f'DNS=%s\n' % config['dns1address'])
network_file.write('DNS=%s\n' % config['dns1address'])
if 'dns2address' in config:
network_file.write(f'DNS=%s\n' % config['dns2address'])
network_file.write('DNS=%s\n' % config['dns2address'])
# If ipv4gateway is not within ipv4address's range, then add a route section
if self._outside_network4(config, 'ipv4address', 'ipv4gateway'):
......@@ -143,7 +143,7 @@ class ConfigSystemdNetworkd(Plugin):
network_file.write('Destination=%s\n' % config['ipv6gateway'])
network_file.write('Scope=link\n')
network_file.write(f'\n')
network_file.write('\n')
# Finally close the file
network_file.close()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment