Commit de7cbf63 authored by Antoine Millet's avatar Antoine Millet
Browse files

Added comments in cli handler for each function type

parent 2b8a2d60
Loading
Loading
Loading
Loading
+45 −0
Original line number Diff line number Diff line
@@ -74,6 +74,10 @@ class CliHandler(RegisteredCCHandler):
        #    order |= OrderedSet(tags)
        return {'objects': objects, 'order': list(order)}

    #
    # VM actions:
    #

    def _vm_action(self, query, method, *args, **kwargs):
        """ Do an action on a virtual machine.
        """
@@ -175,6 +179,10 @@ class CliHandler(RegisteredCCHandler):

        return errs.get_dict()

    #
    # Account management:
    #

    @listed
    def passwd(self, query, password, method='ssha'):
        """ Define a new password for selected users.
@@ -413,6 +421,10 @@ class CliHandler(RegisteredCCHandler):

        return errs.get_dict()

    #
    # Rights management:
    #

    @listed
    def loadrights(self):
        """ Get the current ruleset.
@@ -431,6 +443,10 @@ class CliHandler(RegisteredCCHandler):
        self.client.check('rights')
        self.server.rights.load(ruleset)

    #
    # Nodes actions:
    #

    @listed
    def execute(self, query, command):
        """ Execute command on matched objects (must be roles hv or host).
@@ -492,6 +508,10 @@ class CliHandler(RegisteredCCHandler):

        return errs.get_dict()

    #
    # Jobs management:
    #

    @listed
    def cancel(self, query):
        """ Cancel a job.
@@ -589,6 +609,10 @@ class CliHandler(RegisteredCCHandler):

        return errs.get_dict()

    #
    # Script management:
    #

    @listed
    def loadscript(self, name):
        """ Get the content of a script stored ont he server.
@@ -660,6 +684,11 @@ class CliHandler(RegisteredCCHandler):
                    errs.success(obj['id'], 'ok.', jobs=job_id)
        return errs.get_dict()


    #
    # Election / Migration / Cloning:
    #

    @listed
    def electiontypes(self):
        return Elector.ALGO_BY_TYPES
@@ -745,6 +774,10 @@ class CliHandler(RegisteredCCHandler):
                                                  'hv_source': vm['p'],
                                                  'hv_dest': dest['id']})

    #
    # Remote console:
    #

    @listed
    def console(self, tql):
        """ Start a remote console on object matching the provided tql.
@@ -766,6 +799,10 @@ class CliHandler(RegisteredCCHandler):
                errs.error(obj['id'], 'bad role')
        return errs.get_dict()

    #
    # Remote shell:
    #

    @listed
    def rshell(self, tql):
        """ Start a remote shell on object matching the provided tql.
@@ -819,6 +856,10 @@ class CliHandler(RegisteredCCHandler):
        stun.close()
        return rcode

    #
    # Port forwarding:
    #

    @listed
    def forward(self, label, login, port, destination='127.0.0.1'):
        """ Forward a TCP port to the client.
@@ -839,6 +880,10 @@ class CliHandler(RegisteredCCHandler):
        # Create tunnel to the CLI
        self.client.register_tunnel('forward', host_client, s2n_tun)

    #
    # Debug:
    #

    @listed
    def dbstats(self):
        """ Get statistics about tql database.