diff options
| author | Dmitry Tantsur <dtantsur@protonmail.com> | 2020-09-18 17:52:49 +0200 |
|---|---|---|
| committer | Dmitry Tantsur <dtantsur@protonmail.com> | 2020-09-18 17:52:49 +0200 |
| commit | fe6b6879689a0d793ee22ac9ba7155488f1d6a88 (patch) | |
| tree | 30fc74b8392afb1deef55abf3b6f7af8167ef8d0 /ironic_python_agent/errors.py | |
| parent | 67f053d94cbde91f9fd9de9e32be32b3436daea7 (diff) | |
| download | ironic-python-agent-fe6b6879689a0d793ee22ac9ba7155488f1d6a88.tar.gz | |
When reporting that agent is busy, report the executed command
Also make this API return a proper HTTP code (409 instead of 500).
Change-Id: I5d86878b5ed6142ed2630adee78c0867c49b663f
Diffstat (limited to 'ironic_python_agent/errors.py')
| -rw-r--r-- | ironic_python_agent/errors.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ironic_python_agent/errors.py b/ironic_python_agent/errors.py index bf0253dd..0f7a185c 100644 --- a/ironic_python_agent/errors.py +++ b/ironic_python_agent/errors.py @@ -91,6 +91,15 @@ class RequestedObjectNotFoundError(NotFound): super(RequestedObjectNotFoundError, self).__init__(details) +class AgentIsBusy(CommandExecutionError): + + message = 'Agent is busy' + status_code = 409 + + def __init__(self, command_name): + super().__init__('executing command %s' % command_name) + + class IronicAPIError(RESTError): """Error raised when a call to the agent API fails.""" |
