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
968e9453
Commit
968e9453
authored
Feb 11, 2019
by
Matthieu Lamalle
Browse files
correction username
parent
858e2cc0
Changes
2
Hide whitespace changes
Inline
Side-by-side
scripts/controller
View file @
968e9453
...
...
@@ -260,7 +260,7 @@ class ServerRunner(ZephirCommonController):
async
def
exec_describe
(
self
,
job_id
,
automation
):
if
automation
==
'salt'
:
results
=
await
self
.
call
(
'v1.execution.salt.job.describe'
,
jid
=
str
(
job_id
))
jid
=
str
(
job_id
))
else
:
raise
Exception
(
_
(
'Automation engine not supported: {}'
).
format
(
automation
))
ret
=
[]
...
...
@@ -487,9 +487,9 @@ class ServerRunner(ZephirCommonController):
raise
ApplicationError
(
'serverselection.error'
,
reason
=
str
(
err
))
@
register_wamp
(
'v1.serverselection.user.role.get'
,
notification_uri
=
None
,
database
=
True
)
async
def
get_serverselection_user_role
(
self
,
cursor
,
serverselectionid
,
ser
verselectionuser
):
async
def
get_serverselection_user_role
(
self
,
cursor
,
serverselectionid
,
u
ser
name
):
try
:
return
self
.
serverselection
.
get_serverselection_user_role
(
cursor
,
serverselectionid
,
ser
verselectionuser
)
return
self
.
serverselection
.
get_serverselection_user_role
(
cursor
,
serverselectionid
,
u
ser
name
)
except
ServerSelectionErrorDatabaseNotAvailable
as
err
:
raise
ApplicationError
(
'serverselection.error.database_not_available'
,
reason
=
str
(
err
))
...
...
@@ -503,9 +503,9 @@ class ServerRunner(ZephirCommonController):
raise
ApplicationError
(
'serverselection.error'
,
reason
=
str
(
err
))
@
register_wamp
(
'v1.serverselection.user.role.server.get'
,
notification_uri
=
None
,
database
=
True
)
async
def
get_serverselection_user_server_role
(
self
,
cursor
,
serverid
,
ser
verselectionuser
):
async
def
get_serverselection_user_server_role
(
self
,
cursor
,
serverid
,
u
ser
name
):
try
:
return
self
.
serverselection
.
get_serverselection_user_server_role
(
cursor
,
serverid
,
ser
verselectionuser
)
return
self
.
serverselection
.
get_serverselection_user_server_role
(
cursor
,
serverid
,
u
ser
name
)
except
ServerSelectionErrorDatabaseNotAvailable
as
err
:
raise
ApplicationError
(
'serverselection.error.database_not_available'
,
reason
=
str
(
err
))
...
...
@@ -517,6 +517,35 @@ class ServerRunner(ZephirCommonController):
raise
ApplicationError
(
'serverselection.error.unknown_serverselection_id'
,
reason
=
str
(
err
))
except
ServerSelectionError
as
err
:
raise
ApplicationError
(
'serverselection.error'
,
reason
=
str
(
err
))
@
register_wamp
(
'v1.serverselection.exec.command'
,
notification_uri
=
None
,
database
=
True
)
#FIXME notification
async
def
exec_cmd_on_serverserverselection
(
self
,
cursor
,
serverselection_id
,
command
):
"""
Transfer command transmitted to automation (salt, ...)
"""
servers
=
self
.
serverselection
.
describe_serverselection
(
cursor
,
serverselection_id
)[
'serverselectionserversid'
]
automation
=
None
servers_id
=
[]
for
server_id
in
servers
:
if
automation
is
None
:
automation
,
automation_command
=
self
.
serverselection
.
get_automation_command
(
cursor
,
server_id
)
servers_id
.
append
(
server_id
)
minion_pattern
=
','
.
join
(
servers_id
)
if
automation
==
'salt'
:
result
=
await
self
.
call
(
'v1.execution.salt.exec'
,
minion_pattern
=
minion_pattern
,
command
=
automation_command
,
arg
=
command
,
client_mode
=
'local_async'
)
else
:
raise
Exception
(
_
(
'Automation engine not supported: {}'
).
format
(
automation
))
if
result
[
'minions'
]
!=
servers_id
:
raise
Exception
(
_
(
'Job ({}) not executed only in selected server, all client affected : {}'
).
format
(
result
[
'jid'
],
result
[
'minions'
]))
return
{
'job_id'
:
result
[
'jid'
],
'servers_id'
:
servers_id
,
'command'
:
command
,
'automation'
:
automation
}
if
__name__
==
'__main__'
:
run
(
ServerRunner
)
src/python/server/serverselection/query.py
View file @
968e9453
...
...
@@ -120,6 +120,9 @@ SERVERSELECTION_UPDATE_USER = '''
RETURNING *
'''
"""
List all serverselection of a user
"""
SERVERSELECTION_USER_SERVER_LIST
=
'''
SELECT json_agg(c) AS serverselectionserversid
FROM (
...
...
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