-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pybridge: Implement cockpit-bridge --version; some small cleanups #19234
Conversation
@@ -270,6 +271,9 @@ def main(*, beipack: bool = False) -> None: | |||
if args.packages: | |||
Packages().show() | |||
return | |||
elif args.version: | |||
print(f'Version: {__version__}\nProtocol: 1') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The C bridge looks like this:
Version: 287
Protocol: 1
Payloads: dbus-json3 http-stream1 http-stream2 stream packet fsread1
fsreplace1 fswatch1 fslist1 null echo websocket-stream1
Authorization: crypt1
The "Authorization: crypt1" is hardcoded in the C bridge, and thus not really useful. We could implement "Payloads:" if we care, but I doubt it's actually useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason the inconsistency of how we get the two newlines printed out is bothering me. I will ignore that little nag, though. :)
2362493
to
09f5d87
Compare
Meh, this isn't worth the renaming, I backed out that commit from this PR. |
09f5d87
to
499d1ec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As usual: the main part of the patch is fine but there's lots of bickering over the beifang ;)
@@ -270,6 +271,9 @@ def main(*, beipack: bool = False) -> None: | |||
if args.packages: | |||
Packages().show() | |||
return | |||
elif args.version: | |||
print(f'Version: {__version__}\nProtocol: 1') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason the inconsistency of how we get the two newlines printed out is bothering me. I will ignore that little nag, though. :)
499d1ec
to
14dff0d
Compare
src/cockpit/bridge.py
Outdated
@@ -62,12 +62,12 @@ def export(self, path: str, obj: bus.BaseObject) -> None: | |||
class Bridge(Router, PackagesListener): | |||
internal_bus: InternalBus | |||
packages: Optional[Packages] | |||
bridge_rules: List[JsonObject] | |||
bridge_configs: List[BridgeConfig] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commit message for this part is no longer accurate, since this was never a JsonObject...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
This previously initialized `self.bridge_rules`, but never actually updated it, due to the `bridge_configs` vs. `bridge_rules` confusion. Change both the class member and the local variable to `bridge_configs` to become consistent with `Packages.get_bridge_configs()`. Fix the type of this rules list. mypy spotted this after fixing the variable confusion.
It has never been in the manpage, it isn't implemented (it just starts the protocol), and the C version's output is next to useless for users. We can implement this if/when we ever get an use case.
It was defined in argparse, but entirely ignored, so that it started the protocol. Also add it to the manpage. This also unbreaks the regular cockpit/ws container builds, as they use --version to define the tag. Add an integration test which exercises all non-protocol options. Fixes cockpit-project#19233
14dff0d
to
842a7db
Compare
args: argparse.Namespace | ||
|
||
def __init__(self, args: argparse.Namespace): | ||
self.internal_bus = InternalBus(EXPORTS) | ||
self.bridge_rules = [] | ||
self.bridge_configs = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess ()
would be nicer here, but no biggie.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now, thanks!
It was defined in argparse, but entirely ignored, so that it started the
protocol. Also add it to the manpage.
This also unbreaks the regular cockpit/ws container builds, as they use
--version to define the tag.
Add an integration test which exercises all non-protocol options.
Fixes #19233
See https://quay.io/repository/cockpit/ws?tab=tags , this stopped updating since we moved Fedora 38 to the pybridge.