Skip to content

Commit 3a03c4f

Browse files
committed
Refactor frontpanel binary path handling
- Updated the frontpanel binary path to support multiple locations. - Introduced a new function to find the executable in the specified paths. - Ensured compatibility with both the admin home and local bin directories.
1 parent e24c12c commit 3a03c4f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

plugin/show-frontpanel.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,17 @@
1313
from srlinux.mgmt.cli.cli_state import CliState
1414
from srlinux.syntax import Syntax
1515

16-
frontpanel_bin_path = "/home/admin/frontpanel"
16+
_frontpanel_bin_paths = [
17+
"/home/admin/frontpanel",
18+
"/usr/local/bin/frontpanel",
19+
]
20+
21+
22+
def _find_frontpanel_bin():
23+
for path in _frontpanel_bin_paths:
24+
if os.path.isfile(path) and os.access(path, os.X_OK):
25+
return path
26+
return _frontpanel_bin_paths[0]
1727

1828

1929
class Plugin(CliPlugin):
@@ -115,7 +125,7 @@ def _print(
115125

116126
protocol = self._image_protocol()
117127
cmd = [
118-
frontpanel_bin_path,
128+
_find_frontpanel_bin(),
119129
"-image",
120130
chassis_type,
121131
"-image-protocol",

0 commit comments

Comments
 (0)