Commit 95e66245 authored by Antoine Millet's avatar Antoine Millet
Browse files

Added batch identifier to runscript and runplugin

parent 890af2ad
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -670,7 +670,7 @@ class CliHandler(RegisteredCCHandler):
        return errs.get_dict()

    @listed
    def runscript(self, query, script, *args):
    def runscript(self, query, script, batch=None, *args):
        """ Execute a script on matching nodes.
        """

@@ -691,7 +691,8 @@ class CliHandler(RegisteredCCHandler):

                try:
                    job_id = node.script_run(sha1_hash, script,
                                             self.client.login, *args)
                                             self.client.login, batch=batch,
                                             *args)
                except RpcError as err:
                    errs.error(obj['id'], '%s (exc: %s)' % (err.message,
                                                            err.exception))
@@ -800,7 +801,7 @@ class CliHandler(RegisteredCCHandler):
        return errs.get_dict()

    @listed
    def runplugin(self, query, plugin, method, **kwargs):
    def runplugin(self, query, plugin, method, batch=None, **kwargs):
        """ Execute a plugin method on matching nodes.
        """

@@ -821,7 +822,7 @@ class CliHandler(RegisteredCCHandler):

                try:
                    job_id = node.plugin_run(plugin, method, self.client.login,
                                             **kwargs)
                                             batch=batch, **kwargs)
                except RpcError as err:
                    errs.error(obj['id'], '%s (exc: %s)' % (err.message,
                                                            err.exception))
+5 −4
Original line number Diff line number Diff line
@@ -69,15 +69,16 @@ class HostClient(Client):
        self.proxy.forward(tun.label, port, destination)
        return tun

    def script_run(self, sha1_hash, script, *args):
    def script_run(self, sha1_hash, script, batch=None, *args):
        """ Run a script on the host.
        """
        return self.conn.call('script_run', sha1_hash, script, *args)
        return self.conn.call('script_run', sha1_hash, script, batch=batch, *args)

    def plugin_run(self, sha1_hash, plugin, method, **kwargs):
    def plugin_run(self, sha1_hash, plugin, method, batch=None, **kwargs):
        """ Run a plugin method on the host.
        """
        return self.conn.call('plugin_run', sha1_hash, plugin, method, **kwargs)
        return self.conn.call('plugin_run', sha1_hash, plugin, method,
                              batch=batch, **kwargs)

    def plugin_install(self, sha1_hash, plugin):
        """ Install a plugin on the host.