Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
python: major peer initialization overhaul
Our PeerStateListener and SuperuserStartup (and DBusStartup and ControlMessageStartup) objects had a strange and overlapping role which was basically two things: - notification of completion of a task, with possible notification of failure, including reporting of exceptions - an authentication hook The first thing is basically something like a Future, which is equivalent to an asynchronous function call. In some places, we were even bridging this gap, such as via DBusStartup creating a future for the (async) D-Bus call to wait on. Let's push things away from these custom types and towards a more unified approach of asynchronous function calls for startup of peers. Failures are reported via exceptions and completion is reported by returning. For the authentication hook usecase, we can use the existing ferny.InteractionResponder interface. It also works as an async method call, so add some async helpers to CockpitServerProtocol for sending/receiving authorize challenge/responses asynchronously. Drop our own custom askpass code and use ferny's. Also drop all handling of authorize control messages from Peer — this all happens via the ferny InteractionAgent now. Our "pseudo" test helper needs a rewrite to deal with that. We also drop our send-stderr control message solution that we copied from the C bridge and replace it with a solution which passes the original stderr over the redirected stderr from the ferny agent. Add a bunch of unit tests to check that peers behave properly in various situations.
- Loading branch information