Skip to content

Commit

Permalink
APIGW-10470 Delphix startup screen should be updated for DCT applianc…
Browse files Browse the repository at this point in the history
…es (#501)
  • Loading branch information
eyalkaspi-delphix authored Nov 7, 2024
1 parent 7984e08 commit 8aa7466
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions files/common/usr/bin/delphix-startup-screen
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python3
#
# Copyright 2020 Delphix
# Copyright 2020, 2024 Delphix
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -126,12 +126,21 @@ def load_header(stdscr) -> Any:
Display the header information for the main screen.
"""
WIN_LEN, WIN_HT = set_common_variables(stdscr)
cmd = ['get-appliance-version', '--patch']
cp = subprocess.run(cmd,

cp = subprocess.run('get-packaged-app-version',
stdout=subprocess.PIPE,
universal_newlines=True,
check=True)
version: str = cp.stdout
if not version:
# Use the packaged app version when available
# fallback to the appliance version
cmd = ['get-appliance-version', '--patch']
cp = subprocess.run(cmd,
stdout=subprocess.PIPE,
universal_newlines=True,
check=True)
version = cp.stdout

stdscr.clear()
stdscr.addstr(1, 2, LOGO + str(version), curses.A_BOLD)
Expand Down Expand Up @@ -219,15 +228,16 @@ def get_network_status() -> Tuple[str, str]:

ipaddrs = []
for interface in interfaces():
if interface == "lo":
if (interface == "lo" or interface == "docker0" or
interface.startswith("br-")):
continue
for link in ifaddresses(interface)[AF_INET]:
for link in ifaddresses(interface).get(AF_INET, []):
ipaddrs.append(link['addr'])
hostname = os.uname()[1]
return (hostname, ", ".join(ipaddrs))


# pylint: disable-msg=too-many-locals
# pylint: disable-msg=too-many-locals, too-many-statements
def display_status(stdscr, win):
"""
Main display and input function. This function will display
Expand Down Expand Up @@ -292,8 +302,12 @@ def display_status(stdscr, win):
statuswin.hline(START, 5, curses.ACS_HLINE, 45)
for i in strout.split("\n"):
START += 1
statuswin.addstr(START, 2, " " * (width - 3), curses.A_BOLD)
statuswin.addstr(START, 5, str(i), curses.A_STANDOUT)
try:
statuswin.addstr(START, 2, " " * (width - 3), curses.A_BOLD)
statuswin.addstr(START, 5, str(i), curses.A_STANDOUT)
except curses.error as e:
# Probably exceeded available space
logging.info(e)
statuswin.noutrefresh()

curses.doupdate()
Expand Down

0 comments on commit 8aa7466

Please sign in to comment.