def __getitem__(self, key): try: if key not in self.support_console_types: raise exceptions.UnsupportedConsoleType(key) if key == 'webmks': data = nc().servers.get_console_url(server, key) else: data = self.console_method(key) console_data = data.get('remote_console', data.get('console')) url = console_data['url'] except exceptions.UnsupportedConsoleType as ex: url = ex.message except Exception as e: url = _('Cannot get console url: %s') % str(e) return url
def __getitem__(self, key): try: if key not in self.support_console_types: raise exceptions.UnsupportedConsoleType(key) if key == 'webmks': data = nc(mks_version).servers.get_console_url( server, key) else: data = self.console_method(key) console_data = data.get( 'remote_console', data.get('console')) url = console_data['url'] except exceptions.UnsupportedConsoleType as ex: url = ex.message except Exception as e: url = _('Cannot get console url: %s') % six.text_type(e) return url
def __getitem__(self, key): try: if key not in self.support_console_types: raise exceptions.UnsupportedConsoleType(key) if key == 'webmks': data = nc(mks_version).servers.get_console_url( server, key) else: data = self.console_method(key) console_data = data.get('remote_console', data.get('console')) url = console_data['url'] except (exceptions.BadRequest, exceptions.UnsupportedConsoleType) as e: unavailable = 'Unavailable console type' unsupport = 'Unsupported console_type' if unavailable in e.message or unsupport in e.message: url = e.message else: raise except exception.InvalidServiceVersion: url = _('Nova service version %s is ' 'unavailable') % mks_version return url