Loading cccli/command/host.py +17 −17 Original line number Diff line number Diff line Loading @@ -6,27 +6,29 @@ CloudControl physical host related commands from cccli.exception import * from sjrpc.core.exceptions import * from cccli.printer import Printer, color from cccli.command.command import Command, OptionCommand from cccli.command.command import TqlCommand class Command_exec(Command): class Command_exec(TqlCommand): '''Execute a command on the remote host''' def __init__(self, cli, argv0): TqlCommand.__init__(self, cli, argv0) self.set_usage("%prog [options] <tql> <command>") def __call__(self, argv): if len(argv) != 3: # arg parse self.parse_args(argv) if len(self.args) != 2: raise cmdBadArgument() try: self.cli.rpc.call("exec", argv[1], argv[2]) except RpcError as e: raise cmdError("RPCError: %s"%str(e)) def usage(self): return "Usage: exec <tql> <command>" # rpc call self.rpccall("exec", self.args[0], self.args[1]) class Command_shutdown(OptionCommand): class Command_shutdown(TqlCommand): '''Shutdown a physical host''' def __init__(self, cli, argv0): OptionCommand.__init__(self, cli, argv0) TqlCommand.__init__(self, cli, argv0) self.set_usage("%prog [options] <tql>") self.add_option("-r", "--reboot", action="store_true", dest="reboot", help="Reboot after shutdown (default)") Loading @@ -36,11 +38,9 @@ class Command_shutdown(OptionCommand): help="do not go through init but go down real fast") def __call__(self, argv): # arg parse self.parse_args(argv) if len(self.args) != 1: raise cmdBadArgument() try: self.cli.rpc.call("shutdown", self.args[0], self.options.reboot, self.rpccall("shutdown", self.args[0], self.options.reboot, self.options.graceful) except RpcError as e: raise cmdError("RPCError: %s"%str(e)) Loading
cccli/command/host.py +17 −17 Original line number Diff line number Diff line Loading @@ -6,27 +6,29 @@ CloudControl physical host related commands from cccli.exception import * from sjrpc.core.exceptions import * from cccli.printer import Printer, color from cccli.command.command import Command, OptionCommand from cccli.command.command import TqlCommand class Command_exec(Command): class Command_exec(TqlCommand): '''Execute a command on the remote host''' def __init__(self, cli, argv0): TqlCommand.__init__(self, cli, argv0) self.set_usage("%prog [options] <tql> <command>") def __call__(self, argv): if len(argv) != 3: # arg parse self.parse_args(argv) if len(self.args) != 2: raise cmdBadArgument() try: self.cli.rpc.call("exec", argv[1], argv[2]) except RpcError as e: raise cmdError("RPCError: %s"%str(e)) def usage(self): return "Usage: exec <tql> <command>" # rpc call self.rpccall("exec", self.args[0], self.args[1]) class Command_shutdown(OptionCommand): class Command_shutdown(TqlCommand): '''Shutdown a physical host''' def __init__(self, cli, argv0): OptionCommand.__init__(self, cli, argv0) TqlCommand.__init__(self, cli, argv0) self.set_usage("%prog [options] <tql>") self.add_option("-r", "--reboot", action="store_true", dest="reboot", help="Reboot after shutdown (default)") Loading @@ -36,11 +38,9 @@ class Command_shutdown(OptionCommand): help="do not go through init but go down real fast") def __call__(self, argv): # arg parse self.parse_args(argv) if len(self.args) != 1: raise cmdBadArgument() try: self.cli.rpc.call("shutdown", self.args[0], self.options.reboot, self.rpccall("shutdown", self.args[0], self.options.reboot, self.options.graceful) except RpcError as e: raise cmdError("RPCError: %s"%str(e))