Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
EOLE
Zéphir
Services
Server Manager
Commits
f64c6451
Commit
f64c6451
authored
Feb 12, 2019
by
Matthieu Lamalle
Browse files
catch errors and pass
parent
67cca5bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
scripts/controller
View file @
f64c6451
...
...
@@ -190,9 +190,9 @@ class ServerRunner(ZephirCommonController):
@
register_wamp
(
'v1.server.exec.command'
,
notification_uri
=
'v1.server.executed'
,
database
=
True
)
async
def
exec_cmd_on_server
(
self
,
cursor
,
server_id
,
command
):
return
self
.
_exec_cmd_on_server
(
cursor
,
server_id
,
command
)
return
await
self
.
_exec_cmd_on_server
(
cursor
,
server_id
,
command
)
def
_exec_cmd_on_server
(
self
,
cursor
,
server_id
,
command
):
async
def
_exec_cmd_on_server
(
self
,
cursor
,
server_id
,
command
):
"""
Transfer command transmitted to automation (salt, ...)
"""
...
...
@@ -531,9 +531,19 @@ class ServerRunner(ZephirCommonController):
"""
servers
=
self
.
serverselection
.
describe_serverselection
(
cursor
,
serverselection_id
)[
'serverselectionserversid'
]
ret
=
[]
for
server_id
in
servers
:
ret
.
append
(
self
.
_exec_cmd_on_server
(
cursor
,
server_id
,
command
))
try
:
ret
.
append
(
await
self
.
_exec_cmd_on_server
(
cursor
,
server_id
,
command
))
except
ServerErrorUnknownServerId
as
err
:
ret
.
append
({
'job_id'
:
''
,
'server_id'
:
server_id
,
'command'
:
command
,
'automation'
:
'salt'
,
'executed'
:
True
,
'success'
:
False
,
'retcode'
:
1
,
'return'
:
str
(
err
)})
return
ret
...
...
src/python/server/server/query.py
View file @
f64c6451
...
...
@@ -160,7 +160,7 @@ def fetch_server_dict(cursor, serverid: int):
def
fetch_server
(
cursor
,
serverid
:
int
):
fetched
=
fetchone
(
cursor
,
FETCH_SERVER
,
(
serverid
,))
if
fetched
is
None
:
raise
Exception
(
_
(
'unable to find a server with ID {}'
).
format
(
serverid
))
raise
ServerErrorUnknownServerId
(
_
(
'unable to find a server with ID {}'
).
format
(
serverid
))
return
fetched
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment