diff options
| author | Rui Chen <chenrui.momo@gmail.com> | 2016-06-08 18:23:01 +0800 |
|---|---|---|
| committer | Rui Chen <chenrui.momo@gmail.com> | 2016-06-16 21:13:47 +0800 |
| commit | 8cceaddaac43729c068f0f99675967ee3a7b228a (patch) | |
| tree | 23352efc6fe60c3ca19ca7e27ed2a727f4ed53c4 /openstackclient/compute/v2 | |
| parent | 114eeeb0236d29a325abbf13b41a9a385746b367 (diff) | |
| download | python-openstackclient-8cceaddaac43729c068f0f99675967ee3a7b228a.tar.gz | |
Fix console url show command broken in microversion case
The response data of nova get_xxx_console API is changed
from "console" to "remote_console" in microversion 2.6, and nova
server side API schema verify the spice vnc type to "spice-html5",
update OSC code to apply these change so that OSC can work in
different nova microversion cases.
Change-Id: I3bb4fe057e656209d00d2bb308ac3f7f837cb03f
Closes-Bug: #1590318
Diffstat (limited to 'openstackclient/compute/v2')
| -rw-r--r-- | openstackclient/compute/v2/console.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/openstackclient/compute/v2/console.py b/openstackclient/compute/v2/console.py index 97d3f318..4179fa5c 100644 --- a/openstackclient/compute/v2/console.py +++ b/openstackclient/compute/v2/console.py @@ -93,7 +93,7 @@ class ShowConsoleURL(command.ShowOne): '--spice', dest='url_type', action='store_const', - const='spice', + const='spice-html5', help=_("Show SPICE console URL") ) return parser @@ -105,14 +105,20 @@ class ShowConsoleURL(command.ShowOne): parsed_args.server, ) + data = None if parsed_args.url_type in ['novnc', 'xvpvnc']: data = server.get_vnc_console(parsed_args.url_type) - if parsed_args.url_type in ['spice']: + if parsed_args.url_type in ['spice-html5']: data = server.get_spice_console(parsed_args.url_type) if not data: return ({}, {}) info = {} - info.update(data['console']) + # NOTE(Rui Chen): Return 'remote_console' in compute microversion API + # 2.6 and later, return 'console' in compute + # microversion API from 2.0 to 2.5, do compatibility + # handle for different microversion API. + console_data = data.get('remote_console', data.get('console')) + info.update(console_data) return zip(*sorted(six.iteritems(info))) |
