Loading cloudcontrol/server/clients/cli.py +45 −0 Original line number Diff line number Diff line Loading @@ -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. """ Loading Loading @@ -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. Loading Loading @@ -413,6 +421,10 @@ class CliHandler(RegisteredCCHandler): return errs.get_dict() # # Rights management: # @listed def loadrights(self): """ Get the current ruleset. Loading @@ -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). Loading Loading @@ -492,6 +508,10 @@ class CliHandler(RegisteredCCHandler): return errs.get_dict() # # Jobs management: # @listed def cancel(self, query): """ Cancel a job. Loading Loading @@ -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. Loading Loading @@ -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 Loading Loading @@ -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. Loading @@ -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. Loading Loading @@ -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. Loading @@ -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. Loading Loading
cloudcontrol/server/clients/cli.py +45 −0 Original line number Diff line number Diff line Loading @@ -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. """ Loading Loading @@ -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. Loading Loading @@ -413,6 +421,10 @@ class CliHandler(RegisteredCCHandler): return errs.get_dict() # # Rights management: # @listed def loadrights(self): """ Get the current ruleset. Loading @@ -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). Loading Loading @@ -492,6 +508,10 @@ class CliHandler(RegisteredCCHandler): return errs.get_dict() # # Jobs management: # @listed def cancel(self, query): """ Cancel a job. Loading Loading @@ -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. Loading Loading @@ -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 Loading Loading @@ -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. Loading @@ -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. Loading Loading @@ -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. Loading @@ -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. Loading