Fix bug.
This commit is contained in:
parent
e2b5f71716
commit
66a1e77b8d
|
@ -76,7 +76,7 @@ def main():
|
||||||
new_addr = ""
|
new_addr = ""
|
||||||
dhcp4 = input(f"Do you want to use dynamic address(dhcp) for interface {interface}? (y/n)")
|
dhcp4 = input(f"Do you want to use dynamic address(dhcp) for interface {interface}? (y/n)")
|
||||||
if dhcp4.lower() != "y":
|
if dhcp4.lower() != "y":
|
||||||
dhcp4 = "no"
|
dhcp4 = False
|
||||||
while new_addr == "":
|
while new_addr == "":
|
||||||
new_addr = input(f"New address for interface {interface}: ")
|
new_addr = input(f"New address for interface {interface}: ")
|
||||||
try:
|
try:
|
||||||
|
@ -97,7 +97,7 @@ def main():
|
||||||
change_flag = True
|
change_flag = True
|
||||||
else:
|
else:
|
||||||
change_flag = True
|
change_flag = True
|
||||||
dhcp4 = "true"
|
dhcp4 = True
|
||||||
if old_address != None:
|
if old_address != None:
|
||||||
del addresses[interface]
|
del addresses[interface]
|
||||||
dhcp[interface] = dhcp4
|
dhcp[interface] = dhcp4
|
||||||
|
@ -135,7 +135,7 @@ def main():
|
||||||
if dhcp4 != None:
|
if dhcp4 != None:
|
||||||
netplan_config_yaml['network']['ethernets'][interface]['dhcp4'] = dhcp4
|
netplan_config_yaml['network']['ethernets'][interface]['dhcp4'] = dhcp4
|
||||||
nameservers = interface_content.get('nameservers')
|
nameservers = interface_content.get('nameservers')
|
||||||
if nameservers == None and dhcp4 == 'no':
|
if nameservers == None and dhcp4 == False:
|
||||||
nameservers = {'addresses': []}
|
nameservers = {'addresses': []}
|
||||||
if nameservers != None:
|
if nameservers != None:
|
||||||
nameservers_addresses = nameservers.get('addresses')
|
nameservers_addresses = nameservers.get('addresses')
|
||||||
|
|
Loading…
Reference in New Issue