This commit is contained in:
BoHung Chiu 2022-08-25 22:26:39 +08:00
parent e2b5f71716
commit 66a1e77b8d
1 changed files with 3 additions and 3 deletions

View File

@ -76,7 +76,7 @@ def main():
new_addr = ""
dhcp4 = input(f"Do you want to use dynamic address(dhcp) for interface {interface}? (y/n)")
if dhcp4.lower() != "y":
dhcp4 = "no"
dhcp4 = False
while new_addr == "":
new_addr = input(f"New address for interface {interface}: ")
try:
@ -97,7 +97,7 @@ def main():
change_flag = True
else:
change_flag = True
dhcp4 = "true"
dhcp4 = True
if old_address != None:
del addresses[interface]
dhcp[interface] = dhcp4
@ -135,7 +135,7 @@ def main():
if dhcp4 != None:
netplan_config_yaml['network']['ethernets'][interface]['dhcp4'] = dhcp4
nameservers = interface_content.get('nameservers')
if nameservers == None and dhcp4 == 'no':
if nameservers == None and dhcp4 == False:
nameservers = {'addresses': []}
if nameservers != None:
nameservers_addresses = nameservers.get('addresses')