Commit ea59faf4 authored by Bruno Boiget's avatar Bruno Boiget
Browse files

remove unwanted function in controller (bad branch)

parent 2c1e3b22
......@@ -521,34 +521,5 @@ class ServerRunner(ZephirCommonController):
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)
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