Show hostname instead of RaSCSI

This commit is contained in:
Daniel Markstedt 2021-10-28 13:29:06 -07:00
parent 52dbfdb44a
commit 278b01c1a4

View File

@ -185,7 +185,8 @@ def device_list():
return device_list return device_list
def get_ip(): def get_ip_and_host():
host = socket.gethostname()
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try: try:
# mock ip address; doesn't have to be reachable # mock ip address; doesn't have to be reachable
@ -195,7 +196,7 @@ def get_ip():
ip = '127.0.0.1' ip = '127.0.0.1'
finally: finally:
s.close() s.close()
return ip return ip, host
def send_pb_command(payload): def send_pb_command(payload):
""" """
@ -286,7 +287,7 @@ def formatted_output():
else: else:
output.append("No image mounted!") output.append("No image mounted!")
output.append(f"RaSCSI IP {ip}") output.append(f"{host}:{ip}")
return output return output
def start_splash(): def start_splash():
@ -307,7 +308,7 @@ cwd = getcwd()
start_splash() start_splash()
ip = get_ip() ip, host = get_ip_and_host()
with GracefulInterruptHandler() as h: with GracefulInterruptHandler() as h:
while True: while True: