TVD: fix project plugin OSC to display errors
The project plugin mapping used by the TVD plugin uses the openstack client for configration by the admin user. This patch catches the plugin exceptions to make sure the user sees the error. Change-Id: I8dce5e1daf2d0c4796c53e831b81462b27e8bc9c
This commit is contained in:
parent
9da1930583
commit
64e4050ed1
@ -13,10 +13,14 @@
|
||||
|
||||
"""Project Plugin mapping action implementations"""
|
||||
|
||||
import six
|
||||
|
||||
from openstack import exceptions as os_exceptions
|
||||
from openstack.network import network_service
|
||||
from openstack import resource
|
||||
from openstackclient.i18n import _
|
||||
from osc_lib.command import command
|
||||
from osc_lib import exceptions as osc_exceptions
|
||||
from osc_lib import utils
|
||||
|
||||
project_plugin_maps_path = "/project-plugin-maps"
|
||||
@ -82,7 +86,13 @@ class CreateProjectPluginMap(command.ShowOne):
|
||||
def take_action(self, parsed_args):
|
||||
client = self.app.client_manager.network
|
||||
attrs = _get_attrs(parsed_args)
|
||||
try:
|
||||
obj = client._create(ProjectPluginMap, **attrs)
|
||||
except os_exceptions.HttpException as exc:
|
||||
msg = _("Error while executing command: %s") % exc.message
|
||||
if exc.details:
|
||||
msg += ", " + six.text_type(exc.details)
|
||||
raise osc_exceptions.CommandError(msg)
|
||||
display_columns, columns = _get_columns(obj)
|
||||
data = utils.get_item_properties(obj, columns, formatters={})
|
||||
return (display_columns, data)
|
||||
|
Loading…
Reference in New Issue
Block a user