From 7185888ac94f99e896b3b3cb807f09f699118983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Dunand?= Date: Mon, 14 May 2018 15:57:41 +0200 Subject: [PATCH] Add install/uninstall command --- cloudcontrol/cli/commands/vm.py | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/cloudcontrol/cli/commands/vm.py b/cloudcontrol/cli/commands/vm.py index b9ecf57..f7d2961 100644 --- a/cloudcontrol/cli/commands/vm.py +++ b/cloudcontrol/cli/commands/vm.py @@ -331,6 +331,42 @@ class Command_unrescue(TqlCommand): def remote_functions(self): return set(("unrescue",)) +class Command_install(TqlCommand): + '''Switch VMs to install mode''' + + def __init__(self, cli, argv0): + TqlCommand.__init__(self, cli, argv0) + self.tql_filter += "&r=vm&status=stopped&mode=normal" + + def __call__(self, argv): + # arg parse + self.parse_args(argv) + if len(self.args) != 1: + raise cmdBadArgument() + # rpc call + self.rpccall("install", self.args[0]) + + def remote_functions(self): + return set(("install",)) + +class Command_uninstall(TqlCommand): + '''Switch VMs back from install mode''' + + def __init__(self, cli, argv0): + TqlCommand.__init__(self, cli, argv0) + self.tql_filter += "&r=vm&status=stopped&mode=install" + + def __call__(self, argv): + # arg parse + self.parse_args(argv) + if len(self.args) != 1: + raise cmdBadArgument() + # rpc call + self.rpccall("uninstall", self.args[0]) + + def remote_functions(self): + return set(("uninstall",)) + class Command_title(TqlCommand): '''Set a VM title''' -- GitLab