Commit bb97ec22 authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Support more console types in "server console" cmd

Refs #36

New types: vnc-ws, vnc-wss
parent 03cc64ad
......@@ -834,16 +834,45 @@ class server_shutdown(_CycladesInit, _ServerWait):
class ConsoleTypeArgument(ValueArgument):
def value(self):
return getattr(self, '_value', None)
def value(self, new_value):
if new_value:
v = new_value.lower()
if v in CycladesComputeClient.CONSOLE_TYPES:
self._value = v
raise CLIInvalidArgument(
'Invalid console type %s' % new_value, details=[
'Valid console types: %s' % (
', '.join(CycladesComputeClient.CONSOLE_TYPES)), ])
class server_console(_CycladesInit, OptionalOutput):
"""Create a VNC console and show connection information"""
arguments = dict(
'Valid values: %s Default: %s' % (
', '.join(CycladesComputeClient.CONSOLE_TYPES),
def _run(self, server_id):
self.error('The following credentials will be invalidated shortly')
self.print_(self.client.get_server_console(server_id), self.print_dict)
ctype = self['console_type'] or CycladesComputeClient.CONSOLE_TYPES[0]
self.client.get_server_console(server_id, ctype), self.print_dict)
def main(self, server_id):
super(self.__class__, self)._run()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment