Uncomment new check for gateway IP address

This commit is contained in:
SecondThundeR 2021-04-20 15:02:11 +03:00
parent 1d04c92258
commit 1d37e5a49e
1 changed files with 15 additions and 21 deletions

View File

@ -189,27 +189,21 @@ def ask_to_configure_network():
fg='red' fg='red'
) )
if not len(gateway := input('Enter your gateway (router) IP address or leave blank for none: ').strip()): gateway = input('Enter your gateway (router) IP address or leave blank for none: ').strip()
gateway = None # Implemented new check for correct gateway IP address
while 1:
# Assuming that gateway (router) IP address doesn't contain subnet, try:
# we can implement this check for it if len(gateway) == 0:
# Implemented new check for correct IP input gateway = None
else:
#gateway = input('Enter your gateway (router) IP address or leave blank for none: ').strip() ipaddress.ip_address(gateway)
#while 1: break
# try: except ValueError:
# if len(gateway) == 0: log(
# gateway = None "You need to enter a valid gateway (router) IP address.",
# else: level=LOG_LEVELS.Warning,
# ipaddress.ip_address(gateway) fg='red'
# break )
# except ValueError:
# log(
# "You need to enter a valid gateway (router) IP address.",
# level=LOG_LEVELS.Warning,
# fg='red'
# )
dns = None dns = None
if len(dns_input := input('Enter your DNS servers (space separated, blank for none): ').strip()): if len(dns_input := input('Enter your DNS servers (space separated, blank for none): ').strip()):