Merge "Change to use new console URI"

This commit is contained in:
Jenkins 2017-09-06 01:25:18 +00:00 committed by Gerrit Code Review
commit 00b81835b5
2 changed files with 18 additions and 8 deletions

View File

@ -807,11 +807,18 @@ class ShowConsoleURL(command.ShowOne):
)
type_group = parser.add_mutually_exclusive_group()
type_group.add_argument(
'--serial',
'--shellinabox',
dest='url_type',
action='store_const',
const='serial',
help=_("Show serial console URL"),
const='shellinabox',
help=_("Show shellinabox serial console URL"),
)
type_group.add_argument(
'--socat',
dest='url_type',
action='store_const',
const='socat',
help=_("Show socat serial console URL"),
)
return parser
@ -822,10 +829,11 @@ class ShowConsoleURL(command.ShowOne):
parsed_args.server,
)
data = bc_client.server.get_serial_console(server.uuid)
data = bc_client.server.get_remote_console(
server.uuid, parsed_args.url_type)
if not data:
return ({}, {})
info = {}
info.update(data.console)
info.update(data._info)
return zip(*sorted(info.items()))

View File

@ -153,7 +153,9 @@ class ServerManager(base.ManagerWithFind):
'server': base.getid(server_id), 'port_id': port_id}
return self._delete(url)
def get_serial_console(self, server_id):
url = '/servers/%(server)s/serial_console' % {
def get_remote_console(self, server_id, url_type):
url = '/servers/%(server)s/remote_consoles' % {
'server': base.getid(server_id)}
return self._get(url)
data = {'protocol': 'serial',
'type': url_type}
return self._create(url, data=data)