|
1 | 1 | #!/usr/bin/python3
|
2 | 2 | #
|
3 |
| -# Copyright 2020 Delphix |
| 3 | +# Copyright 2020, 2024 Delphix |
4 | 4 | #
|
5 | 5 | # Licensed under the Apache License, Version 2.0 (the "License");
|
6 | 6 | # you may not use this file except in compliance with the License.
|
@@ -126,12 +126,21 @@ def load_header(stdscr) -> Any:
|
126 | 126 | Display the header information for the main screen.
|
127 | 127 | """
|
128 | 128 | WIN_LEN, WIN_HT = set_common_variables(stdscr)
|
129 |
| - cmd = ['get-appliance-version', '--patch'] |
130 |
| - cp = subprocess.run(cmd, |
| 129 | + |
| 130 | + cp = subprocess.run('get-packaged-app-version', |
131 | 131 | stdout=subprocess.PIPE,
|
132 | 132 | universal_newlines=True,
|
133 | 133 | check=True)
|
134 | 134 | version: str = cp.stdout
|
| 135 | + if not version: |
| 136 | + # Use the packaged app version when available |
| 137 | + # fallback to the appliance version |
| 138 | + cmd = ['get-appliance-version', '--patch'] |
| 139 | + cp = subprocess.run(cmd, |
| 140 | + stdout=subprocess.PIPE, |
| 141 | + universal_newlines=True, |
| 142 | + check=True) |
| 143 | + version = cp.stdout |
135 | 144 |
|
136 | 145 | stdscr.clear()
|
137 | 146 | stdscr.addstr(1, 2, LOGO + str(version), curses.A_BOLD)
|
@@ -219,15 +228,16 @@ def get_network_status() -> Tuple[str, str]:
|
219 | 228 |
|
220 | 229 | ipaddrs = []
|
221 | 230 | for interface in interfaces():
|
222 |
| - if interface == "lo": |
| 231 | + if (interface == "lo" or interface == "docker0" or |
| 232 | + interface.startswith("br-")): |
223 | 233 | continue
|
224 |
| - for link in ifaddresses(interface)[AF_INET]: |
| 234 | + for link in ifaddresses(interface).get(AF_INET, []): |
225 | 235 | ipaddrs.append(link['addr'])
|
226 | 236 | hostname = os.uname()[1]
|
227 | 237 | return (hostname, ", ".join(ipaddrs))
|
228 | 238 |
|
229 | 239 |
|
230 |
| -# pylint: disable-msg=too-many-locals |
| 240 | +# pylint: disable-msg=too-many-locals, too-many-statements |
231 | 241 | def display_status(stdscr, win):
|
232 | 242 | """
|
233 | 243 | Main display and input function. This function will display
|
@@ -292,8 +302,12 @@ def display_status(stdscr, win):
|
292 | 302 | statuswin.hline(START, 5, curses.ACS_HLINE, 45)
|
293 | 303 | for i in strout.split("\n"):
|
294 | 304 | START += 1
|
295 |
| - statuswin.addstr(START, 2, " " * (width - 3), curses.A_BOLD) |
296 |
| - statuswin.addstr(START, 5, str(i), curses.A_STANDOUT) |
| 305 | + try: |
| 306 | + statuswin.addstr(START, 2, " " * (width - 3), curses.A_BOLD) |
| 307 | + statuswin.addstr(START, 5, str(i), curses.A_STANDOUT) |
| 308 | + except curses.error as e: |
| 309 | + # Probably exceeded available space |
| 310 | + logging.info(e) |
297 | 311 | statuswin.noutrefresh()
|
298 | 312 |
|
299 | 313 | curses.doupdate()
|
|
0 commit comments