Commit 3d63de0c authored by Antoine Millet's avatar Antoine Millet
Browse files

Added execute client handler method.

parent a393864c
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -143,6 +143,20 @@ class ClientHandler(OnlineCCHandler):
    @listed
    def resume(self, query):
        self._vm_action(query, 'resume_vm')

    @pure
    @listed
    def execute(self, query, command):
        query += '&hv'
        query = TqlQuery(query)
        hypervisors = query.filter(list(self._server.iterrole('hypervisor')),
                                   key=lambda o,n: o.get_tags([n]).get(n))
        outputs = []
        for hv in hypervisors:
            outputs.append(hv.connection.call('execute_command', command))

        return outputs

class AuthenticationError(Exception):
    pass