X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/blobdiff_plain/632ab6dde450c5e7b35f8817816c9d04294bd230..9f1b11fe7e9983a386990be531879cb5727457b5:/code/controls.py diff --git a/code/controls.py b/code/controls.py index 1d9b824..9c43a41 100644 --- a/code/controls.py +++ b/code/controls.py @@ -201,7 +201,7 @@ def listHost(machine): out, err = remctl('control', machine.name, 'listhost', err=True) if err: return None - return out + return out.strip() def deleteVM(machine): """Delete a VM.""" @@ -242,7 +242,7 @@ def commandResult(username, state, fields): out, err = remctl('control', machine.name, 'reboot', err=True) if err: - if re.match("Error: Domain '.*' does not exist.", err): + if re.match("machine '.*' is not on", err): raise InvalidInput("action", "reboot", "Machine is not on") else: @@ -259,7 +259,7 @@ def commandResult(username, state, fields): elif action == 'Power off': out, err = remctl('control', machine.name, 'destroy', err=True) if err: - if re.match("Error: Domain '.*' does not exist.", err): + if re.match("machine '.*' is not on", err): raise InvalidInput("action", "Power off", "Machine is not on.") else: @@ -269,7 +269,7 @@ def commandResult(username, state, fields): elif action == 'Shutdown': out, err = remctl('control', machine.name, 'shutdown', err=True) if err: - if re.match("Error: Domain '.*' does not exist.", err): + if re.match("machine '.*' is not on", err): raise InvalidInput("action", "Shutdown", "Machine is not on.") else: