mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-10-12 01:58:46 +02:00
During the reported incident the API answered "Maintenance is in progress. Please try again later." after a successful DNS resolution and TCP connection, and ctrld reported it as API_UNREACHABLE. Nothing in the client could tell that answer apart from the API refusing the request, so callers had to guess from an HTTP status that does not carry the distinction. Add IsMaintenance. The API answers every public request in hard maintenance mode with HTTP 503 and error.code 50302 (Application::ERROR_HARD_MAINTENANCE), exported as MaintenanceCode, and IsMaintenance classifies on that code. It falls back to the message for deployments that answer without the code, which a test covers so that path cannot silently drop. The answer's "body" is an empty JSON array; a test pins that the error decode does not depend on it. 50301 (service unavailable) and 50003 (read-only mode) are deliberately not maintenance: the first is a failure, and read-only only gates authenticated controllers, so it never answers /utility or /logs. Maintenance is temporary and says nothing about the configuration that was asked for. The HTTP status cannot classify it on its own, because a maintenance answer can arrive with a client-error status that otherwise means the same request will be refused again, so callers must ask this question before they act on a status.