OperServ: add SHUTDOWN and RESTART
All checks were successful
CI / check (push) Successful in 3m31s

This commit is contained in:
Jean Chevronnet 2026-07-16 01:02:10 +00:00
parent dd43b9a331
commit b2442f85e6
No known key found for this signature in database
6 changed files with 96 additions and 1 deletions

View file

@ -111,6 +111,10 @@ pub enum NetAction {
// Internal only: send an email (plaintext + optional HTML). The link layer
// pipes it to the configured mail command off-thread; never serialized.
SendEmail { to: String, subject: String, text: String, html: Option<String> },
// Internal only: stop the services process (OperServ SHUTDOWN/RESTART). The
// link layer exits cleanly; `restart` exits non-zero so a supervisor (systemd
// Restart=) brings it back. Never serialized.
Shutdown { restart: bool, reason: String },
}
// How to answer a registration once its credentials have been derived.
@ -281,6 +285,13 @@ impl ServiceCtx {
self.actions.push(NetAction::SendEmail { to: to.into(), subject: subject.into(), text: text.into(), html });
}
// Stop the services process (OperServ SHUTDOWN/RESTART). The link layer exits
// once this action is reached; `restart` exits non-zero so a supervisor
// respawns us.
pub fn shutdown(&mut self, restart: bool, reason: impl Into<String>) {
self.actions.push(NetAction::Shutdown { restart, reason: reason.into() });
}
// Hand a password change to the engine to finish: its derivation runs off the
// reactor, then the engine commits it and notices `uid`, sourced from `agent`.
pub fn defer_password(&mut self, account: impl Into<String>, password: impl Into<String>, agent: impl Into<String>, uid: impl Into<String>) {