Commit eb34e4e2 authored by Matthieu Lamalle's avatar Matthieu Lamalle Committed by Bruno Boiget
Browse files

fix_#57 exec deploy

parent 47af9156
......@@ -38,7 +38,7 @@ RUN git clone "${CONTAINERPILOT_REPO_URL}" "/tmp/orchestrate" \
# API messages description
ARG MESSAGES_API_REPO_URL=https://gitlab.mim.ovh/EOLE/Zephir/messages-api.git
ARG MESSAGES_API_REPO_REF=0.0.4-dev
ARG MESSAGES_API_REPO_REF=0.0.5-dev
RUN git clone "${MESSAGES_API_REPO_URL}" "/tmp/messages-api" \
&& cd /tmp/messages-api \
......
......@@ -245,6 +245,9 @@ class ServerRunner(ZephirCommonController):
@register_wamp('v1.server.exec.deploy', notification_uri=None, database=True)
async def exec_deploy(self, cursor, server_id):
return await self._exec_deploy_on_server(cursor, server_id)
async def _exec_deploy_on_server(self, cursor, server_id):
automation, automation_command = self.server.get_automation_command(cursor, server_id)
if automation == 'salt':
result = await self.call('v1.execution.salt.configuration.deploy',
......@@ -546,6 +549,24 @@ class ServerRunner(ZephirCommonController):
'return': str(err)})
return ret
@register_wamp('v1.serverselection.exec.deploy', notification_uri=None, database=True) #FIXME notification
async def exec_deploy_on_serverserverselection(self, cursor, serverselection_id):
"""
Transfer command transmitted to automation (salt, ...)
"""
servers = self.serverselection.describe_serverselection(cursor, serverselection_id)['serverselectionserversid']
ret = []
for server_id in servers:
try:
ret.append(await self._exec_deploy_on_server(cursor, server_id))
except ServerErrorUnknownServerId as err:
ret.append({'job_id': '',
'server_id': server_id,
'command': 'deploy',
'automation': 'salt',
'executed': False})
return ret
if __name__ == '__main__':
run(ServerRunner)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment