From 8aa7466acb07fe209a101c7878800fd4aeba836e Mon Sep 17 00:00:00 2001 From: eyalkaspi-delphix <64774532+eyalkaspi-delphix@users.noreply.github.com> Date: Thu, 7 Nov 2024 09:45:59 +0100 Subject: [PATCH] APIGW-10470 Delphix startup screen should be updated for DCT appliances (#501) --- files/common/usr/bin/delphix-startup-screen | 30 +++++++++++++++------ 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/files/common/usr/bin/delphix-startup-screen b/files/common/usr/bin/delphix-startup-screen index a5a032b3..5dbabce0 100755 --- a/files/common/usr/bin/delphix-startup-screen +++ b/files/common/usr/bin/delphix-startup-screen @@ -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. @@ -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) @@ -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 @@ -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()