Skip to content

Commit

Permalink
bridge: Add back menu/tool names to cockpit-bridge --packages
Browse files Browse the repository at this point in the history
  • Loading branch information
martinpitt committed Dec 8, 2023
1 parent c6f5e84 commit 7656e7b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/cockpit/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import functools
import gzip
import io
import itertools
import json
import logging
import mimetypes
Expand Down Expand Up @@ -490,8 +491,13 @@ def load(self) -> None:
def show(self):
for name in sorted(self.packages):
package = self.packages[name]
menuitems = ''
print(f'{name:20} {menuitems:40} {package.path}')
menuitems = []
for entry in itertools.chain(
package.manifest.get('menu', {}).values(),
package.manifest.get('tools', {}).values()):
with contextlib.suppress(KeyError):
menuitems.append(entry['label'])
print(f'{name:20} {", ".join(menuitems):40} {package.path}')

def get_bridge_configs(self) -> Sequence[BridgeConfig]:
def yield_configs():
Expand Down
3 changes: 2 additions & 1 deletion test/verify/check-connection
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,8 @@ UnixPath=/run/cockpit/session

packages = m.execute("cockpit-bridge --packages")
self.assertRegex(packages, r"(^|\n)base1\s+.*/usr/share/cockpit/base1")
self.assertRegex(packages, r"(^|\n)system\s+.*/usr/share/cockpit/systemd")
# also includes menu and tools entries
self.assertRegex(packages, r"(^|\n)system\s.*Services.*Terminal.*\s/usr/share/cockpit/systemd")

if self.is_pybridge():
bridges = json.loads(m.execute("cockpit-bridge --bridges").strip())
Expand Down

0 comments on commit 7656e7b

Please sign in to comment.