mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Return a 503 when the Salt master is down; for commands and auths
This commit is contained in:
parent
036c14cc59
commit
e83f73d3e8
@ -394,6 +394,9 @@ def hypermedia_handler(*args, **kwargs):
|
||||
except (salt.exceptions.EauthAuthenticationError,
|
||||
salt.exceptions.TokenAuthenticationError):
|
||||
raise cherrypy.HTTPError(401)
|
||||
except (salt.exceptions.SaltDaemonNotRunning,
|
||||
salt.exceptions.SaltReqTimeoutError) as exc:
|
||||
raise cherrypy.HTTPError(503, exc.strerror)
|
||||
except cherrypy.CherryPyException:
|
||||
raise
|
||||
except Exception as exc:
|
||||
@ -1361,6 +1364,10 @@ class Login(LowDataAdapter):
|
||||
]
|
||||
}}
|
||||
'''
|
||||
if not self.api.is_master_running():
|
||||
raise salt.exceptions.SaltDaemonNotRunning(
|
||||
'Salt Master is not available.')
|
||||
|
||||
# the urlencoded_processor will wrap this in a list
|
||||
if isinstance(cherrypy.serving.request.lowstate, list):
|
||||
creds = cherrypy.serving.request.lowstate[0]
|
||||
|
Loading…
Reference in New Issue
Block a user