Enable H201: do not write "except:"

Fixes all occurrences of this. We have a custom exception handler
in Horizon anyway that only catches ClientException in most of these
cases, but this commit lets us gate on the other cases.

Change-Id: Iea3dc13817f3e5b775b2024424bf3a906da5584b
Closes-Bug: #1211657
This commit is contained in:
Kieran Spear 2013-08-13 16:54:59 +10:00
parent fe659b231a
commit 242c8df495
106 changed files with 268 additions and 269 deletions

View File

@ -440,7 +440,7 @@ class Dashboard(Registry, HorizonComponent):
"""
try:
return self._registered(self.default_panel).get_absolute_url()
except:
except Exception:
# Logging here since this will often be called in a template
# where the exception would be hidden.
LOG.exception("Error reversing absolute URL for %s." % self)
@ -512,7 +512,7 @@ class Dashboard(Registry, HorizonComponent):
try:
before_import_registry = copy.copy(self._registry)
import_module('.%s.panel' % panel, package)
except:
except Exception:
self._registry = before_import_registry
if module_has_submodule(mod, panel):
raise
@ -750,7 +750,7 @@ class Site(Registry, HorizonComponent):
try:
before_import_registry = copy.copy(self._registry)
import_module('%s.%s' % (package, mod_name))
except:
except Exception:
self._registry = before_import_registry
if module_has_submodule(mod, mod_name):
raise
@ -780,7 +780,7 @@ class Site(Registry, HorizonComponent):
try:
before_import_registry = copy.copy(self._registry)
import_module('%s.%s' % (app, mod_name))
except:
except Exception:
self._registry = before_import_registry
if module_has_submodule(mod, mod_name):
raise

View File

@ -89,7 +89,7 @@ class ModalFormView(ModalFormMixin, generic.FormView):
def form_valid(self, form):
try:
handled = form.handle(self.request, form.cleaned_data)
except:
except Exception:
handled = None
exceptions.handle(self.request)

View File

@ -565,7 +565,7 @@ class Cell(html.HTMLElement):
data = self.column.empty_value(self.datum)
else:
data = self.column.empty_value
except:
except Exception:
data = None
exc_info = sys.exc_info()
raise template.TemplateSyntaxError, exc_info[1], exc_info[2]
@ -1210,7 +1210,7 @@ class DataTable(object):
datum = new_row.get_data(request, obj_id)
new_row.load_cells(datum)
error = False
except:
except Exception:
datum = None
error = exceptions.handle(request, ignore=True)
if request.is_ajax():
@ -1344,7 +1344,7 @@ class DataTable(object):
self.selected = True
row.classes.append('current_selected')
rows.append(row)
except:
except Exception:
# Exceptions can be swallowed at the template level here,
# re-raising as a TemplateSyntaxError makes them visible.
LOG.exception("Error while rendering table rows.")

View File

@ -117,7 +117,7 @@ class TabGroup(html.HTMLElement):
if tab.load and not tab.data_loaded:
try:
tab._data = tab.get_context_data(self.request)
except:
except Exception:
tab._data = False
exceptions.handle(self.request)
@ -303,7 +303,7 @@ class Tab(html.HTMLElement):
context = self.data
except exceptions.Http302:
raise
except:
except Exception:
exc_type, exc_value, exc_traceback = sys.exc_info()
raise TemplateSyntaxError, exc_value, exc_traceback
return render_to_string(self.get_template_name(self.request), context)

View File

@ -40,7 +40,7 @@ class TabView(generic.TemplateView):
context["tab_group"] = tab_group
# Make sure our data is pre-loaded to capture errors.
context["tab_group"].load_tab_data()
except:
except Exception:
exceptions.handle(self.request)
return context

View File

@ -44,7 +44,7 @@ class ParseDateNode(template.Node):
if not timezone.is_aware(parsed):
parsed = timezone.make_aware(parsed, timezone.utc)
return parsed
except:
except Exception:
pass
return None

View File

@ -68,7 +68,7 @@ class IPField(forms.Field):
self.ip = netaddr.IPNetwork(value)
else:
self.ip = netaddr.IPAddress(value)
except:
except Exception:
raise ValidationError(self.invalid_format_message)
if not any([self.version & IPv4 > 0 and self.ip.version == 4,

View File

@ -48,6 +48,6 @@ class APIView(generic.TemplateView):
context = self.get_context_data(**kwargs)
try:
context = self.get_data(request, context, *args, **kwargs)
except:
except Exception:
exceptions.handle(request)
return self.render_to_response(context)

View File

@ -373,7 +373,7 @@ class Step(object):
workflow_context)
self._action = self.action_class(self.workflow.request,
context)
except:
except Exception:
LOG.exception("Problem instantiating action class.")
raise
return self._action
@ -795,7 +795,7 @@ class Workflow(html.HTMLElement):
partial = True
else:
self.context = step.contribute(data or {}, self.context)
except:
except Exception:
partial = True
exceptions.handle(self.request)
if not self.handle(self.request, self.context):

View File

@ -134,7 +134,7 @@ class WorkflowView(generic.TemplateView):
if workflow.is_valid():
try:
success = workflow.finalize()
except:
except Exception:
success = False
exceptions.handle(request)
next = self.request.REQUEST.get(workflow.redirect_param_name, None)

View File

@ -303,14 +303,14 @@ def user_update(request, user, **data):
# Update user details
try:
user = manager.update(user, **data)
except:
except Exception:
error = exceptions.handle(request, ignore=True)
# Update default tenant
try:
user_update_tenant(request, user, project)
user.tenantId = project
except:
except Exception:
error = exceptions.handle(request, ignore=True)
# Check for existing roles
@ -329,7 +329,7 @@ def user_update(request, user, **data):
user_update_password(request, user, password)
if user == request.user.id:
logout(request)
except:
except Exception:
error = exceptions.handle(request, ignore=True)
if error is not None:
@ -491,7 +491,7 @@ def get_default_role(request):
if default and DEFAULT_ROLE is None:
try:
roles = keystoneclient(request, admin=True).roles.list()
except:
except Exception:
roles = []
exceptions.handle(request)
for role in roles:

View File

@ -51,7 +51,7 @@ class Pool(NeutronAPIDictWrapper):
pFormatted['subnet_id'] = self.subnet_id
pFormatted['subnet_name'] = subnet_get(
request, self.subnet_id).cidr
except:
except Exception:
pFormatted['subnet_id'] = self.subnet_id
pFormatted['subnet_name'] = self.subnet_id
@ -60,7 +60,7 @@ class Pool(NeutronAPIDictWrapper):
pFormatted['vip_id'] = self.vip_id
pFormatted['vip_name'] = vip_get(
request, self.vip_id).name
except:
except Exception:
pFormatted['vip_id'] = self.vip_id
pFormatted['vip_name'] = self.vip_id
else:
@ -91,7 +91,7 @@ class Member(NeutronAPIDictWrapper):
mFormatted['pool_id'] = self.pool_id
mFormatted['pool_name'] = pool_get(
request, self.pool_id).name
except:
except Exception:
mFormatted['pool_id'] = self.pool_id
mFormatted['pool_name'] = self.pool_id

View File

@ -165,7 +165,7 @@ class SecurityGroupRule(NeutronAPIDictWrapper):
try:
ip_proto = int(self.ip_protocol)
proto_port = "ip_proto=%d" % ip_proto
except:
except Exception:
# well-defined IP protocol name like TCP, UDP, ICMP.
proto_port = self.ip_protocol
else:

View File

@ -35,7 +35,7 @@ class AdminIndexView(tables.DataTableView):
aggregates = []
try:
aggregates = api.nova.aggregate_list(self.request)
except:
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve aggregate list.'))

View File

@ -111,7 +111,7 @@ class SetDomainContext(tables.Action):
messages.success(request,
_('Domain Context updated to Domain %s.') %
domain.name)
except:
except Exception:
messages.error(request,
_('Unable to set Domain Context.'))

View File

@ -50,7 +50,7 @@ class IndexView(tables.DataTableView):
domains.append(domain)
else:
domains = api.keystone.domain_list(self.request)
except:
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve domain list.'))
return domains
@ -75,7 +75,7 @@ class UpdateDomainView(workflows.WorkflowView):
domain_id)
for field in DOMAIN_INFO_FIELDS:
initial[field] = getattr(domain_info, field, None)
except:
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve domain details.'),
redirect=reverse(DOMAINS_INDEX_URL))

View File

@ -76,7 +76,7 @@ class CreateDomain(workflows.Workflow):
name=data['name'],
description=desc,
enabled=data['enabled'])
except:
except Exception:
exceptions.handle(request, ignore=True)
return False
@ -121,7 +121,7 @@ class UpdateDomain(workflows.Workflow):
name=data['name'],
description=data['description'],
enabled=data['enabled'])
except:
except Exception:
exceptions.handle(request, ignore=True)
return False
return True

View File

@ -44,7 +44,7 @@ class CreateExtraSpec(forms.SelfHandlingForm):
msg = _('Created extra spec "%s".') % data['key']
messages.success(request, msg)
return True
except:
except Exception:
exceptions.handle(request,
_("Unable to create flavor extra spec."))
@ -63,5 +63,5 @@ class EditExtraSpec(forms.SelfHandlingForm):
msg = _('Saved extra spec "%s".') % data['key']
messages.success(request, msg)
return True
except:
except Exception:
exceptions.handle(request, _("Unable to edit extra spec."))

View File

@ -45,7 +45,7 @@ class ExtraSpecMixin(object):
try:
context['flavor'] = api.nova.flavor_get(self.request,
self.kwargs['id'])
except:
except Exception:
exceptions.handle(self.request,
_("Unable to retrieve flavor data."))
return context
@ -60,7 +60,7 @@ class IndexView(ExtraSpecMixin, forms.ModalFormMixin, tables.DataTableView):
flavor_id = self.kwargs['id']
extras_list = api.nova.flavor_get_extras(self.request, flavor_id)
extras_list.sort(key=lambda es: (es.key,))
except:
except Exception:
extras_list = []
exceptions.handle(self.request,
_('Unable to retrieve extra spec list.'))
@ -89,7 +89,7 @@ class EditView(ExtraSpecMixin, forms.ModalFormView):
extra_specs = api.nova.flavor_get_extras(self.request,
flavor_id,
raw=True)
except:
except Exception:
extra_specs = {}
exceptions.handle(self.request,
_("Unable to retrieve flavor extra spec data."))

View File

@ -59,7 +59,7 @@ class CreateFlavor(forms.SelfHandlingForm):
name = self.cleaned_data.get('name')
try:
flavors = api.nova.flavor_list(self.request)
except:
except Exception:
flavors = []
msg = _('Unable to get flavor list')
exceptions.check_message(["Connection", "refused"], msg)
@ -77,7 +77,7 @@ class CreateFlavor(forms.SelfHandlingForm):
flavor_id = self.data.get('flavor_id')
try:
flavors = api.nova.flavor_list(self.request)
except:
except Exception:
flavors = []
msg = _('Unable to get flavor list')
exceptions.check_message(["Connection", "refused"], msg)
@ -104,7 +104,7 @@ class CreateFlavor(forms.SelfHandlingForm):
msg = _('Created flavor "%s".') % data['name']
messages.success(request, msg)
return flavor
except:
except Exception:
exceptions.handle(request, _("Unable to create flavor."))
@ -140,5 +140,5 @@ class EditFlavor(CreateFlavor):
msg = _('Updated flavor "%s".') % data['name']
messages.success(request, msg)
return flavor
except:
except Exception:
exceptions.handle(request, _("Unable to update flavor."))

View File

@ -46,7 +46,7 @@ class IndexView(tables.DataTableView):
flavors = []
try:
flavors = api.nova.flavor_list(request)
except:
except Exception:
exceptions.handle(request,
_('Unable to retrieve flavor list.'))
# Sort flavors by size
@ -73,7 +73,7 @@ class EditView(forms.ModalFormView):
def get_initial(self):
try:
flavor = api.nova.flavor_get(self.request, self.kwargs['id'])
except:
except Exception:
exceptions.handle(self.request,
_("Unable to retrieve flavor data."))
return {'flavor_id': flavor.id,

View File

@ -47,7 +47,7 @@ class CreateGroupForm(forms.SelfHandlingForm):
messages.success(request,
_('Group "%s" was successfully created.')
% data['name'])
except:
except Exception:
exceptions.handle(request, _('Unable to create group.'))
return False
return True
@ -71,7 +71,7 @@ class UpdateGroupForm(forms.SelfHandlingForm):
description=data['description'])
messages.success(request,
_('Group has been updated successfully.'))
except:
except Exception:
exceptions.handle(request, _('Unable to update the group.'))
return False
return True

View File

@ -64,7 +64,7 @@ class IndexView(tables.DataTableView):
if group.domain_id == domain_context:
domain_groups.append(group)
groups = domain_groups
except:
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve group list.'))
return groups
@ -86,7 +86,7 @@ class UpdateView(forms.ModalFormView):
try:
self._object = api.keystone.group_get(self.request,
self.kwargs['group_id'])
except:
except Exception:
redirect = reverse(GROUPS_INDEX_URL)
exceptions.handle(self.request,
_('Unable to update group.'),
@ -144,7 +144,7 @@ class ManageMembersView(GroupManageMixin, tables.DataTableView):
group_members = []
try:
group_members = self._get_group_members()
except:
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve group users.'))
return group_members
@ -165,7 +165,7 @@ class NonMembersView(GroupManageMixin, forms.ModalFormMixin,
group_non_members = []
try:
group_non_members = self._get_group_non_members()
except:
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve users.'))
return group_non_members

View File

@ -35,7 +35,7 @@ class AdminIndexView(tables.DataTableView):
hypervisors = []
try:
hypervisors = api.nova.hypervisor_list(self.request)
except:
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve hypervisor list.'))

View File

@ -56,7 +56,7 @@ class IndexView(tables.DataTableView):
images, self._more = api.glance.image_list_detailed(self.request,
marker=marker,
paginate=True)
except:
except Exception:
self._more = False
msg = _('Unable to retrieve image list.')
exceptions.handle(self.request, msg)

View File

@ -39,7 +39,7 @@ class DefaultQuotasTab(tabs.TableTab):
try:
quota_set = quotas.get_default_quota_data(request)
data = quota_set.items
except:
except Exception:
data = []
exceptions.handle(self.request, _('Unable to get quota info.'))
return data

View File

@ -80,7 +80,7 @@ class AdminIndexView(tables.DataTableView):
search_opts={'marker': marker,
'paginate': True},
all_tenants=True)
except:
except Exception:
self._more = False
exceptions.handle(self.request,
_('Unable to retrieve instance list.'))
@ -88,14 +88,14 @@ class AdminIndexView(tables.DataTableView):
# Gather our flavors to correlate against IDs
try:
flavors = api.nova.flavor_list(self.request)
except:
except Exception:
# If fails to retrieve flavor list, creates an empty list.
flavors = []
# Gather our tenants to correlate against IDs
try:
tenants, has_more = api.keystone.tenant_list(self.request)
except:
except Exception:
tenants = []
msg = _('Unable to retrieve instance project information.')
exceptions.handle(self.request, msg)
@ -113,7 +113,7 @@ class AdminIndexView(tables.DataTableView):
# gets it via nova api.
inst.full_flavor = api.nova.flavor_get(
self.request, flavor_id)
except:
except Exception:
msg = _('Unable to retrieve instance size information.')
exceptions.handle(self.request, msg)
tenant = tenant_dict.get(inst.tenant_id, None)

View File

@ -66,7 +66,7 @@ class CreateNetwork(forms.SelfHandlingForm):
LOG.debug(msg)
messages.success(request, msg)
return network
except:
except Exception:
redirect = reverse('horizon:admin:networks:index')
msg = _('Failed to create network %s') % data['name']
exceptions.handle(request, msg, redirect=redirect)
@ -95,7 +95,7 @@ class UpdateNetwork(forms.SelfHandlingForm):
LOG.debug(msg)
messages.success(request, msg)
return network
except:
except Exception:
msg = _('Failed to update network %s') % data['name']
LOG.info(msg)
redirect = reverse(self.failure_url)

View File

@ -65,7 +65,7 @@ class CreatePort(forms.SelfHandlingForm):
LOG.debug(msg)
messages.success(request, msg)
return port
except:
except Exception:
msg = _('Failed to create a port for network %s') \
% data['network_id']
LOG.info(msg)

View File

@ -39,7 +39,7 @@ class DeletePort(tables.DeleteAction):
def delete(self, request, obj_id):
try:
api.neutron.port_delete(request, obj_id)
except:
except Exception:
msg = _('Failed to delete subnet %s') % obj_id
LOG.info(msg)
network_id = self.table.kwargs['network_id']

View File

@ -37,7 +37,7 @@ class OverviewTab(tabs.Tab):
port_id = self.tab_group.kwargs['port_id']
try:
port = api.neutron.port_get(self.request, port_id)
except:
except Exception:
redirect = reverse('horizon:admin:networks:index')
msg = _('Unable to retrieve port details.')
exceptions.handle(request, msg, redirect=redirect)

View File

@ -50,7 +50,7 @@ class CreateView(forms.ModalFormView):
network_id = self.kwargs["network_id"]
self._object = api.neutron.network_get(self.request,
network_id)
except:
except Exception:
redirect = reverse(self.failure_url,
args=(self.kwargs['network_id'],))
msg = _("Unable to retrieve network.")

View File

@ -35,7 +35,7 @@ class DeleteSubnet(tables.DeleteAction):
def delete(self, request, obj_id):
try:
api.neutron.subnet_delete(request, obj_id)
except:
except Exception:
msg = _('Failed to delete subnet %s') % obj_id
LOG.info(msg)
network_id = self.table.kwargs['network_id']

View File

@ -44,7 +44,7 @@ class CreateSubnet(project_workflows.CreateSubnet):
# created for if admin user does not belong to the tenant.
network = api.neutron.network_get(request,
self.context['network_id'])
except:
except Exception:
msg = (_('Failed to retrieve network %s for a subnet') %
data['network_id'])
LOG.info(msg)

View File

@ -37,7 +37,7 @@ class DeleteNetwork(tables.DeleteAction):
def delete(self, request, obj_id):
try:
api.neutron.network_delete(request, obj_id)
except:
except Exception:
msg = _('Failed to delete network %s') % obj_id
LOG.info(msg)
redirect = reverse('horizon:admin:networks:index')

View File

@ -47,7 +47,7 @@ class IndexView(tables.DataTableView):
if not hasattr(self, "_tenants"):
try:
tenants, has_more = api.keystone.tenant_list(self.request)
except:
except Exception:
tenants = []
msg = _('Unable to retrieve instance project information.')
exceptions.handle(self.request, msg)
@ -59,7 +59,7 @@ class IndexView(tables.DataTableView):
def get_data(self):
try:
networks = api.neutron.network_list(self.request)
except:
except Exception:
networks = []
msg = _('Network list can not be retrieved.')
exceptions.handle(self.request, msg)
@ -90,7 +90,7 @@ class DetailView(tables.MultiTableView):
network_id = self.kwargs['network_id']
subnets = api.neutron.subnet_list(self.request,
network_id=network_id)
except:
except Exception:
subnets = []
msg = _('Subnet list can not be retrieved.')
exceptions.handle(self.request, msg)
@ -102,7 +102,7 @@ class DetailView(tables.MultiTableView):
try:
network_id = self.kwargs['network_id']
ports = api.neutron.port_list(self.request, network_id=network_id)
except:
except Exception:
ports = []
msg = _('Port list can not be retrieved.')
exceptions.handle(self.request, msg)
@ -116,7 +116,7 @@ class DetailView(tables.MultiTableView):
network_id = self.kwargs['network_id']
network = api.neutron.network_get(self.request, network_id)
network.set_id_as_name_if_empty(length=0)
except:
except Exception:
redirect = self.failure_url
exceptions.handle(self.request,
_('Unable to retrieve details for '

View File

@ -60,7 +60,7 @@ class GlobalOverview(usage.UsageView):
# Pre-fill project names
try:
projects, has_more = api.keystone.tenant_list(self.request)
except:
except Exception:
projects = []
exceptions.handle(self.request,
_('Unable to retrieve project list.'))

View File

@ -54,7 +54,7 @@ class TenantContextMixin(object):
self._object = api.keystone.tenant_get(self.request,
tenant_id,
admin=True)
except:
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve project information.'),
redirect=reverse(INDEX_URL))
@ -84,7 +84,7 @@ class IndexView(tables.DataTableView):
domain=domain_context,
paginate=True,
marker=marker)
except:
except Exception:
self._more = False
exceptions.handle(self.request,
_("Unable to retrieve project list."))
@ -113,7 +113,7 @@ class CreateProjectView(workflows.WorkflowView):
for field in quotas.QUOTA_FIELDS:
initial[field] = quota_defaults.get(field).limit
except:
except Exception:
error_msg = _('Unable to retrieve default quota values.')
self.add_error_to_step(error_msg, 'update_quotas')
@ -141,7 +141,7 @@ class UpdateProjectView(workflows.WorkflowView):
tenant_id=project_id)
for field in quotas.QUOTA_FIELDS:
initial[field] = quota_data.get(field).limit
except:
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve project details.'),
redirect=reverse(INDEX_URL))

View File

@ -129,7 +129,7 @@ class UpdateProjectMembersAction(workflows.MembershipAction):
msg = _('Could not find default role "%s" in Keystone') % \
default
raise exceptions.NotFound(msg)
except:
except Exception:
exceptions.handle(self.request,
err_msg,
redirect=reverse(INDEX_URL))
@ -143,7 +143,7 @@ class UpdateProjectMembersAction(workflows.MembershipAction):
try:
all_users = api.keystone.user_list(request,
domain=domain_context)
except:
except Exception:
exceptions.handle(request, err_msg)
users_list = [(user.id, user.name) for user in all_users]
@ -151,7 +151,7 @@ class UpdateProjectMembersAction(workflows.MembershipAction):
role_list = []
try:
role_list = api.keystone.role_list(request)
except:
except Exception:
exceptions.handle(request,
err_msg,
redirect=reverse(INDEX_URL))
@ -170,7 +170,7 @@ class UpdateProjectMembersAction(workflows.MembershipAction):
roles = api.keystone.roles_for_user(self.request,
user.id,
project_id)
except:
except Exception:
exceptions.handle(request,
err_msg,
redirect=reverse(INDEX_URL))
@ -194,7 +194,7 @@ class UpdateProjectMembers(workflows.UpdateMembersStep):
if data:
try:
roles = api.keystone.role_list(self.workflow.request)
except:
except Exception:
exceptions.handle(self.workflow.request,
_('Unable to retrieve user list.'))
@ -237,7 +237,7 @@ class CreateProject(workflows.Workflow):
description=desc,
enabled=data['enabled'],
domain=domain_context)
except:
except Exception:
exceptions.handle(request, ignore=True)
return False
@ -265,7 +265,7 @@ class CreateProject(workflows.Workflow):
role=role.id)
users_added += 1
users_to_add -= users_added
except:
except Exception:
exceptions.handle(request, _('Failed to add %s project members '
'and set project quotas.')
% users_to_add)
@ -281,7 +281,7 @@ class CreateProject(workflows.Workflow):
cinder.tenant_quota_update(request,
project_id,
**cinder_data)
except:
except Exception:
exceptions.handle(request, _('Unable to set project quotas.'))
return True
@ -338,7 +338,7 @@ class UpdateProject(workflows.Workflow):
name=data['name'],
description=data['description'],
enabled=data['enabled'])
except:
except Exception:
exceptions.handle(request, ignore=True)
return False
@ -427,7 +427,7 @@ class UpdateProject(workflows.Workflow):
role=role.id)
users_added += 1
users_to_modify -= users_added
except:
except Exception:
exceptions.handle(request, _('Failed to modify %s project members '
'and update project quotas.')
% users_to_modify)
@ -447,7 +447,7 @@ class UpdateProject(workflows.Workflow):
project_id,
**cinder_data)
return True
except:
except Exception:
exceptions.handle(request, _('Modified project information and '
'members, but unable to modify '
'project quotas.'))

View File

@ -31,7 +31,7 @@ class CreateRoleForm(forms.SelfHandlingForm):
new_user = api.keystone.role_create(request, data["name"])
messages.success(request, _("Role created successfully."))
return new_user
except:
except Exception:
exceptions.handle(request, _('Unable to create role.'))
@ -44,5 +44,5 @@ class UpdateRoleForm(forms.SelfHandlingForm):
api.keystone.role_update(request, data['id'], data["name"])
messages.success(request, _("Role updated successfully."))
return True
except:
except Exception:
exceptions.handle(request, _('Unable to update role.'))

View File

@ -37,7 +37,7 @@ class IndexView(tables.DataTableView):
roles = []
try:
roles = api.keystone.role_list(self.request)
except:
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve roles list.'))
return roles
@ -53,7 +53,7 @@ class UpdateView(forms.ModalFormView):
try:
self._object = api.keystone.role_get(self.request,
self.kwargs['role_id'])
except:
except Exception:
redirect = reverse("horizon:admin:roles:index")
exceptions.handle(self.request,
_('Unable to update role.'),

View File

@ -44,7 +44,7 @@ class IndexView(r_views.IndexView, n_views.IndexView):
try:
routers = api.neutron.router_list(self.request,
search_opts=search_opts)
except:
except Exception:
routers = []
exceptions.handle(self.request,
_('Unable to retrieve router list.'))

View File

@ -115,12 +115,12 @@ class CreateUserForm(BaseUserForm):
data['project'],
new_user.id,
data['role_id'])
except:
except Exception:
exceptions.handle(request,
_('Unable to add user '
'to primary project.'))
return new_user
except:
except Exception:
exceptions.handle(request, _('Unable to create user.'))
@ -162,7 +162,7 @@ class UpdateUserForm(BaseUserForm):
api.keystone.user_update(request, user, **data)
messages.success(request,
_('User has been updated successfully.'))
except:
except Exception:
exceptions.handle(request, ignore=True)
messages.error(request, _('Unable to update the user.'))
return True

View File

@ -47,7 +47,7 @@ class IndexView(tables.DataTableView):
try:
users = api.keystone.user_list(self.request,
domain=domain_context)
except:
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve user list.'))
return users
@ -69,7 +69,7 @@ class UpdateView(forms.ModalFormView):
self._object = api.keystone.user_get(self.request,
self.kwargs['user_id'],
admin=True)
except:
except Exception:
redirect = reverse("horizon:admin:users:index")
exceptions.handle(self.request,
_('Unable to update user.'),
@ -103,7 +103,7 @@ class CreateView(forms.ModalFormView):
kwargs = super(CreateView, self).get_form_kwargs()
try:
roles = api.keystone.role_list(self.request)
except:
except Exception:
redirect = reverse("horizon:admin:users:index")
exceptions.handle(self.request,
_("Unable to retrieve user roles."),

View File

@ -38,7 +38,7 @@ class CreateVolumeType(forms.SelfHandlingForm):
messages.success(request, _('Successfully created volume type: %s')
% data['name'])
return volume_type
except:
except Exception:
exceptions.handle(request,
_('Unable to create volume type.'))
return False

View File

@ -53,7 +53,7 @@ class IndexView(tables.MultiTableView, VolumeTableMixIn):
# Gather our tenants to correlate against IDs
try:
tenants, has_more = keystone.tenant_list(self.request)
except:
except Exception:
tenants = []
msg = _('Unable to retrieve volume project information.')
exceptions.handle(self.request, msg)
@ -69,7 +69,7 @@ class IndexView(tables.MultiTableView, VolumeTableMixIn):
def get_volume_types_data(self):
try:
volume_types = cinder.volume_type_list(self.request)
except:
except Exception:
volume_types = []
exceptions.handle(self.request,
_("Unable to retrieve volume types"))

View File

@ -52,7 +52,7 @@ def download_ec2_bundle(request):
keys = api.keystone.create_ec2_credentials(request,
request.user.id,
tenant_id)
except:
except Exception:
exceptions.handle(request,
_('Unable to fetch EC2 credentials.'),
redirect=request.build_absolute_uri())
@ -88,7 +88,7 @@ def download_ec2_bundle(request):
archive.writestr('cert.pem', credentials.data)
archive.writestr('cacert.pem', cacert.data)
archive.writestr('ec2rc.sh', render_to_string(template, context))
except:
except Exception:
exceptions.handle(request,
_('Error writing zipfile: %(exc)s'),
redirect=request.build_absolute_uri())

View File

@ -44,5 +44,5 @@ class FloatingIpAllocate(forms.SelfHandlingForm):
_('Allocated Floating IP %(ip)s.')
% {"ip": fip.ip})
return fip
except:
except Exception:
exceptions.handle(request, _('Unable to allocate Floating IP.'))

View File

@ -91,7 +91,7 @@ class DisassociateIP(tables.Action):
messages.success(request,
_('Successfully disassociated Floating IP: %s')
% fip.ip)
except:
except Exception:
exceptions.handle(request,
_('Unable to disassociate floating IP.'))
return shortcuts.redirect('horizon:project:access_and_security:index')

View File

@ -55,14 +55,14 @@ class AllocateView(forms.ModalFormView):
context = super(AllocateView, self).get_context_data(**kwargs)
try:
context['usages'] = quotas.tenant_quota_usages(self.request)
except:
except Exception:
exceptions.handle(self.request)
return context
def get_initial(self):
try:
pools = api.network.floating_ip_pools_list(self.request)
except:
except Exception:
pools = []
exceptions.handle(self.request,
_("Unable to retrieve floating IP pools."))

View File

@ -63,7 +63,7 @@ class AssociateIPAction(workflows.Action):
def populate_ip_id_choices(self, request, context):
try:
ips = api.network.tenant_floating_ip_list(self.request)
except:
except Exception:
redirect = reverse('horizon:project:access_and_security:index')
exceptions.handle(self.request,
_('Unable to retrieve floating IP addresses.'),
@ -79,7 +79,7 @@ class AssociateIPAction(workflows.Action):
def populate_instance_id_choices(self, request, context):
try:
targets = api.network.floating_ip_target_list(self.request)
except:
except Exception:
redirect = reverse('horizon:project:access_and_security:index')
exceptions.handle(self.request,
_('Unable to retrieve instance list.'),
@ -137,7 +137,7 @@ class IPAssociationWorkflow(workflows.Workflow):
api.network.floating_ip_associate(request,
data['ip_id'],
data['instance_id'])
except:
except Exception:
exceptions.handle(request)
return False
return True

View File

@ -60,7 +60,7 @@ class ImportKeypair(forms.SelfHandlingForm):
messages.success(request, _('Successfully imported public key: %s')
% data['name'])
return keypair
except:
except Exception:
exceptions.handle(request, ignore=True)
self.api_error(_('Unable to import keypair.'))
return False

View File

@ -74,7 +74,7 @@ class GenerateView(View):
def get(self, request, keypair_name=None):
try:
keypair = api.nova.keypair_create(request, keypair_name)
except:
except Exception:
redirect = reverse('horizon:project:access_and_security:index')
exceptions.handle(self.request,
_('Unable to create keypair: %(exc)s'),

View File

@ -60,7 +60,7 @@ class CreateGroup(forms.SelfHandlingForm):
_('Successfully created security group: %s')
% data['name'])
return sg
except:
except Exception:
redirect = reverse("horizon:project:access_and_security:index")
exceptions.handle(request,
_('Unable to create security group.'),
@ -346,7 +346,7 @@ class AddRule(forms.SelfHandlingForm):
messages.success(request,
_('Successfully added rule: %s') % unicode(rule))
return rule
except:
except Exception:
redirect = reverse("horizon:project:access_and_security:"
"security_groups:detail", args=[data['id']])
exceptions.handle(request,

View File

@ -54,7 +54,7 @@ class DetailView(tables.DataTableView):
sg_id = get_int_or_uuid(self.kwargs['security_group_id'])
try:
self._sg = api.network.security_group_get(self.request, sg_id)
except:
except Exception:
redirect = reverse('horizon:project:access_and_security:index')
exceptions.handle(self.request,
_('Unable to retrieve security group.'),
@ -92,7 +92,7 @@ class AddRuleView(forms.ModalFormView):
try:
groups = api.network.security_group_list(self.request)
except:
except Exception:
groups = []
exceptions.handle(self.request,
_("Unable to retrieve security groups."))

View File

@ -48,7 +48,7 @@ class SecurityGroupsTab(tabs.TableTab):
def get_security_groups_data(self):
try:
security_groups = network.security_group_list(self.request)
except:
except Exception:
security_groups = []
exceptions.handle(self.request,
_('Unable to retrieve security groups.'))
@ -64,7 +64,7 @@ class KeypairsTab(tabs.TableTab):
def get_keypairs_data(self):
try:
keypairs = nova.keypair_list(self.request)
except:
except Exception:
keypairs = []
exceptions.handle(self.request,
_('Unable to retrieve keypair list.'))
@ -80,14 +80,14 @@ class FloatingIPsTab(tabs.TableTab):
def get_floating_ips_data(self):
try:
floating_ips = network.tenant_floating_ip_list(self.request)
except:
except Exception:
floating_ips = []
exceptions.handle(self.request,
_('Unable to retrieve floating IP addresses.'))
try:
floating_ip_pools = network.floating_ip_pools_list(self.request)
except:
except Exception:
floating_ip_pools = []
messages.warning(self.request,
_('Unable to retrieve floating IP pools.'))
@ -96,7 +96,7 @@ class FloatingIPsTab(tabs.TableTab):
instances = []
try:
instances, has_more = nova.server_list(self.request)
except:
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve instance list.'))

View File

@ -68,7 +68,7 @@ class CreateContainer(forms.SelfHandlingForm):
subfolder_name)
messages.success(request, _("Folder created successfully."))
return True
except:
except Exception:
exceptions.handle(request, _('Unable to create container.'))
@ -97,7 +97,7 @@ class UploadObject(forms.SelfHandlingForm):
object_file)
messages.success(request, _("Object was successfully uploaded."))
return obj
except:
except Exception:
exceptions.handle(request, _("Unable to upload object."))
@ -146,7 +146,7 @@ class CopyObject(forms.SelfHandlingForm):
messages.error(request, exc)
raise exceptions.Http302(reverse(index,
args=[wrap_delimiter(orig_container)]))
except:
except Exception:
redirect = reverse(index, args=[wrap_delimiter(orig_container)])
exceptions.handle(request,
_("Unable to copy object."),

View File

@ -56,7 +56,7 @@ class ContainerView(browsers.ResourceBrowserView):
try:
containers, self._more = api.swift.swift_get_containers(
self.request, marker=marker)
except:
except Exception:
msg = _('Unable to retrieve container list.')
exceptions.handle(self.request, msg)
return containers
@ -84,7 +84,7 @@ class ContainerView(browsers.ResourceBrowserView):
container_name,
marker=marker,
prefix=prefix)
except:
except Exception:
self._more = None
objects = []
msg = _('Unable to retrieve object list.')
@ -169,7 +169,7 @@ class UploadView(forms.ModalFormView):
def object_download(request, container_name, object_path):
try:
obj = api.swift.swift_get_object(request, container_name, object_path)
except:
except Exception:
redirect = reverse("horizon:project:containers:index")
exceptions.handle(request,
_("Unable to retrieve object."),
@ -204,7 +204,7 @@ class CopyView(forms.ModalFormView):
kwargs = super(CopyView, self).get_form_kwargs()
try:
containers = api.swift.swift_get_containers(self.request)
except:
except Exception:
redirect = reverse("horizon:project:containers:index")
exceptions.handle(self.request,
_('Unable to list containers.'),

View File

@ -157,7 +157,7 @@ class CreateImageForm(forms.SelfHandlingForm):
_('Your image %s has been queued for creation.') %
data['name'])
return image
except:
except Exception:
exceptions.handle(request, _('Unable to create new image.'))
@ -219,5 +219,5 @@ class UpdateImageForm(forms.SelfHandlingForm):
image = api.glance.image_update(request, image_id, **meta)
messages.success(request, _('Image was successfully updated.'))
return image
except:
except Exception:
exceptions.handle(request, error_updating % image_id)

View File

@ -32,7 +32,7 @@ class OverviewTab(tabs.Tab):
image_id = self.tab_group.kwargs['image_id']
try:
image = api.glance.image_get(self.request, image_id)
except:
except Exception:
redirect = reverse('horizon:project:images_and_snapshots:index')
exceptions.handle(request,
_('Unable to retrieve image details.'),

View File

@ -62,7 +62,7 @@ class UpdateView(forms.ModalFormView):
try:
self._object = api.glance.image_get(self.request,
self.kwargs['image_id'])
except:
except Exception:
msg = _('Unable to retrieve image.')
url = reverse('horizon:project:images_and_snapshots:index')
exceptions.handle(self.request, msg, redirect=url)

View File

@ -50,7 +50,7 @@ class CreateSnapshot(forms.SelfHandlingForm):
messages.success(request, _('Snapshot "%(name)s" created for '
'instance "%(inst)s"') % vals)
return snapshot
except:
except Exception:
redirect = reverse("horizon:project:instances:index")
exceptions.handle(request,
_('Unable to create snapshot.'),

View File

@ -50,7 +50,7 @@ class CreateView(forms.ModalFormView):
try:
self._object = api.nova.server_get(self.request,
self.kwargs["instance_id"])
except:
except Exception:
redirect = reverse('horizon:project:instances:index')
exceptions.handle(self.request,
_("Unable to retrieve instance."),

View File

@ -27,7 +27,7 @@ def get_available_images(request, project_id=None, images_cache=None):
request, filters=public)
[public_images.append(image) for image in images]
images_cache['public_images'] = public_images
except:
except Exception:
exceptions.handle(request,
_("Unable to retrieve public images."))
@ -41,7 +41,7 @@ def get_available_images(request, project_id=None, images_cache=None):
try:
owned_images, _more = glance.image_list_detailed(
request, filters=owner)
except:
except Exception:
exceptions.handle(request,
_("Unable to retrieve images for "
"the current project."))

View File

@ -61,7 +61,7 @@ class IndexView(tables.MultiTableView):
marker=marker)
images = [im for im in all_images
if im.container_format not in ['aki', 'ari']]
except:
except Exception:
images = []
exceptions.handle(self.request, _("Unable to retrieve images."))
return images
@ -70,7 +70,7 @@ class IndexView(tables.MultiTableView):
if is_service_enabled(self.request, 'volume'):
try:
snapshots = api.cinder.volume_snapshot_list(self.request)
except:
except Exception:
snapshots = []
exceptions.handle(self.request, _("Unable to retrieve "
"volume snapshots."))

View File

@ -35,7 +35,7 @@ class OverviewTab(tabs.Tab):
snapshot = cinder.volume_snapshot_get(request, snapshot_id)
volume = cinder.volume_get(request, snapshot.volume_id)
volume.display_name = None
except:
except Exception:
redirect = reverse('horizon:project:images_and_snapshots:index')
exceptions.handle(self.request,
_('Unable to retrieve snapshot details.'),

View File

@ -208,7 +208,7 @@ class LaunchLink(tables.LinkAction):
self.verbose_name = _("Launch Instance")
classes = [c for c in self.classes if c != "disabled"]
self.classes = classes
except:
except Exception:
LOG.exception("Failed to retrieve quota information")
# If we can't get the quota information, leave it to the
# API to check when launching
@ -376,7 +376,7 @@ class SimpleAssociateIP(tables.Action):
messages.success(request,
_("Successfully associated floating IP: %s")
% fip.ip)
except:
except Exception:
exceptions.handle(request,
_("Unable to associate floating IP."))
return shortcuts.redirect("horizon:project:instances:index")
@ -413,7 +413,7 @@ class SimpleDisassociateIP(tables.Action):
"floating IP: %s") % fip.ip)
else:
messages.info(request, _("No floating IPs to disassociate."))
except:
except Exception:
exceptions.handle(request,
_("Unable to disassociate floating IP."))
return shortcuts.redirect("horizon:project:instances:index")

View File

@ -45,7 +45,7 @@ class LogTab(tabs.Tab):
data = api.nova.server_console_output(request,
instance.id,
tail_length=35)
except:
except Exception:
data = _('Unable to get log for instance "%s".') % instance.id
exceptions.handle(request, ignore=True)
return {"instance": instance,
@ -70,7 +70,7 @@ class ConsoleTab(tabs.Tab):
console.url,
getattr(instance, "name", ""),
instance.id)
except:
except Exception:
try:
console = api.nova.server_spice_console(request,
instance.id)
@ -78,7 +78,7 @@ class ConsoleTab(tabs.Tab):
console.url,
getattr(instance, "name", ""),
instance.id)
except:
except Exception:
console_url = None
elif console_type == 'VNC':
try:
@ -87,7 +87,7 @@ class ConsoleTab(tabs.Tab):
console.url,
getattr(instance, "name", ""),
instance.id)
except:
except Exception:
console_url = None
elif console_type == 'SPICE':
try:
@ -96,7 +96,7 @@ class ConsoleTab(tabs.Tab):
console.url,
getattr(instance, "name", ""),
instance.id)
except:
except Exception:
console_url = None
else:
console_url = None

View File

@ -67,7 +67,7 @@ class IndexView(tables.DataTableView):
self.request,
search_opts={'marker': marker,
'paginate': True})
except:
except Exception:
self._more = False
instances = []
exceptions.handle(self.request,
@ -76,7 +76,7 @@ class IndexView(tables.DataTableView):
if instances:
try:
flavors = api.nova.flavor_list(self.request)
except:
except Exception:
flavors = []
exceptions.handle(self.request, ignore=True)
@ -93,7 +93,7 @@ class IndexView(tables.DataTableView):
# get it via nova api.
instance.full_flavor = api.nova.flavor_get(
self.request, flavor_id)
except:
except Exception:
msg = _('Unable to retrieve instance size information.')
exceptions.handle(self.request, msg)
return instances
@ -116,7 +116,7 @@ def console(request, instance_id):
data = api.nova.server_console_output(request,
instance_id,
tail_length=tail)
except:
except Exception:
data = _('Unable to get log for instance "%s".') % instance_id
exceptions.handle(request, ignore=True)
response = http.HttpResponse(mimetype='text/plain')
@ -131,7 +131,7 @@ def vnc(request, instance_id):
instance = api.nova.server_get(request, instance_id)
return shortcuts.redirect(console.url +
("&title=%s(%s)" % (instance.name, instance_id)))
except:
except Exception:
redirect = reverse("horizon:project:instances:index")
msg = _('Unable to get VNC console for instance "%s".') % instance_id
exceptions.handle(request, msg, redirect=redirect)
@ -143,7 +143,7 @@ def spice(request, instance_id):
instance = api.nova.server_get(request, instance_id)
return shortcuts.redirect(console.url +
("&title=%s(%s)" % (instance.name, instance_id)))
except:
except Exception:
redirect = reverse("horizon:project:instances:index")
msg = _('Unable to get SPICE console for instance "%s".') % instance_id
exceptions.handle(request, msg, redirect=redirect)
@ -163,7 +163,7 @@ class UpdateView(workflows.WorkflowView):
instance_id = self.kwargs['instance_id']
try:
self._object = api.nova.server_get(self.request, instance_id)
except:
except Exception:
redirect = reverse("horizon:project:instances:index")
msg = _('Unable to retrieve instance details.')
exceptions.handle(self.request, msg, redirect=redirect)
@ -198,7 +198,7 @@ class DetailView(tabs.TabView):
self.request, instance.flavor["id"])
instance.security_groups = api.network.server_security_groups(
self.request, instance_id)
except:
except Exception:
redirect = reverse('horizon:project:instances:index')
exceptions.handle(self.request,
_('Unable to retrieve details for '
@ -233,7 +233,7 @@ class ResizeView(workflows.WorkflowView):
else:
flavor = api.nova.flavor_get(self.request, flavor_id)
self._object.flavor_name = flavor.name
except:
except Exception:
redirect = reverse("horizon:project:instances:index")
msg = _('Unable to retrieve instance details.')
exceptions.handle(self.request, msg, redirect=redirect)
@ -245,7 +245,7 @@ class ResizeView(workflows.WorkflowView):
flavors = api.nova.flavor_list(self.request)
self._flavors = SortedDict([(str(flavor.id), flavor)
for flavor in flavors])
except:
except Exception:
redirect = reverse("horizon:project:instances:index")
exceptions.handle(self.request,
_('Unable to retrieve flavors.'), redirect=redirect)

View File

@ -128,7 +128,7 @@ class VolumeOptionsAction(workflows.Action):
if v.status == api.cinder.VOLUME_STATE_AVAILABLE]
volume_options.extend([self._get_volume_display_name(vol)
for vol in volumes])
except:
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve list of volumes.'))
return volume_options
@ -141,7 +141,7 @@ class VolumeOptionsAction(workflows.Action):
if s.status == api.cinder.VOLUME_STATE_AVAILABLE]
volume_options.extend([self._get_volume_display_name(snap)
for snap in snapshots])
except:
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve list of volume '
'snapshots.'))
@ -277,7 +277,7 @@ class SetInstanceDetailsAction(workflows.Action):
flavor_list = [(flavor.id, "%s" % flavor.name)
for flavor in sorted(flavors, key=key, reverse=rev)]
except:
except Exception:
flavor_list = []
exceptions.handle(request,
_('Unable to retrieve instance flavors.'))
@ -286,7 +286,7 @@ class SetInstanceDetailsAction(workflows.Action):
def populate_availability_zone_choices(self, request, context):
try:
zones = api.nova.availability_zone_list(request)
except:
except Exception:
zones = []
exceptions.handle(request,
_('Unable to retrieve availability zones.'))
@ -308,7 +308,7 @@ class SetInstanceDetailsAction(workflows.Action):
flavors = json.dumps([f._info for f in
api.nova.flavor_list(self.request)])
extra['flavors'] = flavors
except:
except Exception:
exceptions.handle(self.request,
_("Unable to retrieve quota information."))
return super(SetInstanceDetailsAction, self).get_help_text(extra)
@ -373,7 +373,7 @@ class SetAccessControlsAction(workflows.Action):
try:
keypairs = api.nova.keypair_list(request)
keypair_list = [(kp.name, kp.name) for kp in keypairs]
except:
except Exception:
keypair_list = []
exceptions.handle(request,
_('Unable to retrieve keypairs.'))
@ -389,7 +389,7 @@ class SetAccessControlsAction(workflows.Action):
try:
groups = api.network.security_group_list(request)
security_group_list = [(sg.name, sg.name) for sg in groups]
except:
except Exception:
exceptions.handle(request,
_('Unable to retrieve list of security groups'))
security_group_list = []
@ -465,7 +465,7 @@ class SetNetworkAction(workflows.Action):
for n in networks:
n.set_id_as_name_if_empty()
network_list = [(network.id, network.name) for network in networks]
except:
except Exception:
network_list = []
exceptions.handle(request,
_('Unable to retrieve networks.'))
@ -550,6 +550,6 @@ class LaunchInstance(workflows.Workflow):
instance_count=int(context['count']),
admin_pass=context['admin_pass'])
return True
except:
except Exception:
exceptions.handle(request)
return False

View File

@ -75,7 +75,7 @@ class SetFlavorChoiceAction(workflows.Action):
flavors = json.dumps([f._info for f in
api.nova.flavor_list(self.request)])
extra['flavors'] = flavors
except:
except Exception:
exceptions.handle(self.request,
_("Unable to retrieve quota information."))
return super(SetFlavorChoiceAction, self).get_help_text(extra)
@ -106,6 +106,6 @@ class ResizeInstance(workflows.Workflow):
try:
api.nova.server_resize(request, instance_id, flavor)
return True
except:
except Exception:
exceptions.handle(request)
return False

View File

@ -51,7 +51,7 @@ class UpdateInstanceSecurityGroupsAction(workflows.MembershipAction):
all_groups = []
try:
all_groups = api.network.security_group_list(request)
except:
except Exception:
exceptions.handle(request, err_msg)
groups_list = [(group.id, group.name) for group in all_groups]
@ -111,7 +111,7 @@ class UpdateInstanceInfoAction(workflows.Action):
api.nova.server_update(request,
data['instance_id'],
data['name'])
except:
except Exception:
exceptions.handle(request, ignore=True)
return False
return True

View File

@ -63,7 +63,7 @@ class UpdatePool(forms.SelfHandlingForm):
LOG.debug(msg)
messages.success(request, msg)
return pool
except:
except Exception:
msg = _('Failed to update pool %s') % context['name']
LOG.info(msg)
redirect = reverse(self.failure_url)
@ -101,7 +101,7 @@ class UpdateVip(forms.SelfHandlingForm):
pool_id_choices = []
try:
pools = api.lbaas.pools_get(request)
except:
except Exception:
pools = []
exceptions.handle(request,
_('Unable to retrieve pools list.'))
@ -144,7 +144,7 @@ class UpdateVip(forms.SelfHandlingForm):
LOG.debug(msg)
messages.success(request, msg)
return vip
except:
except Exception:
msg = _('Failed to update VIP %s') % context['name']
LOG.info(msg)
redirect = reverse(self.failure_url)
@ -169,7 +169,7 @@ class UpdateMember(forms.SelfHandlingForm):
pool_id_choices = []
try:
pools = api.lbaas.pools_get(request)
except:
except Exception:
pools = []
exceptions.handle(request,
_('Unable to retrieve pools list.'))
@ -191,7 +191,7 @@ class UpdateMember(forms.SelfHandlingForm):
LOG.debug(msg)
messages.success(request, msg)
return member
except:
except Exception:
msg = _('Failed to update member %s') % context['member_id']
LOG.info(msg)
redirect = reverse(self.failure_url)
@ -238,7 +238,7 @@ class UpdateMonitor(forms.SelfHandlingForm):
LOG.debug(msg)
messages.success(request, msg)
return monitor
except:
except Exception:
msg = _('Failed to update health monitor %s')\
% context['monitor_id']
LOG.info(msg)

View File

@ -166,7 +166,7 @@ class AddPMAssociationLink(tables.LinkAction):
for m in monitors:
if m.id not in datum['health_monitors']:
return True
except:
except Exception:
exceptions.handle(request,
_('Failed to retrieve health monitors.'))
return False

View File

@ -41,7 +41,7 @@ class PoolsTab(tabs.TableTab):
pools = api.lbaas.pools_get(self.tab_group.request)
poolsFormatted = [p.readable(self.tab_group.request) for
p in pools]
except:
except Exception:
poolsFormatted = []
exceptions.handle(self.tab_group.request,
_('Unable to retrieve pools list.'))
@ -59,7 +59,7 @@ class MembersTab(tabs.TableTab):
members = api.lbaas.members_get(self.tab_group.request)
membersFormatted = [m.readable(self.tab_group.request) for
m in members]
except:
except Exception:
membersFormatted = []
exceptions.handle(self.tab_group.request,
_('Unable to retrieve member list.'))
@ -76,7 +76,7 @@ class MonitorsTab(tabs.TableTab):
try:
monitors = api.lbaas.pool_health_monitors_get(
self.tab_group.request)
except:
except Exception:
monitors = []
exceptions.handle(self.tab_group.request,
_('Unable to retrieve monitor list.'))
@ -98,7 +98,7 @@ class PoolDetailsTab(tabs.Tab):
pid = self.tab_group.kwargs['pool_id']
try:
pool = api.lbaas.pool_get(request, pid)
except:
except Exception:
pool = []
exceptions.handle(request,
_('Unable to retrieve pool details.'))
@ -114,7 +114,7 @@ class VipDetailsTab(tabs.Tab):
vid = self.tab_group.kwargs['vip_id']
try:
vip = api.lbaas.vip_get(request, vid)
except:
except Exception:
vip = []
exceptions.handle(self.tab_group.request,
_('Unable to retrieve VIP details.'))
@ -130,7 +130,7 @@ class MemberDetailsTab(tabs.Tab):
mid = self.tab_group.kwargs['member_id']
try:
member = api.lbaas.member_get(request, mid)
except:
except Exception:
member = []
exceptions.handle(self.tab_group.request,
_('Unable to retrieve member details.'))
@ -146,7 +146,7 @@ class MonitorDetailsTab(tabs.Tab):
mid = self.tab_group.kwargs['monitor_id']
try:
monitor = api.lbaas.pool_health_monitor_get(request, mid)
except:
except Exception:
monitor = []
exceptions.handle(self.tab_group.request,
_('Unable to retrieve monitor details.'))

View File

@ -75,34 +75,34 @@ class IndexView(tabs.TabView):
for obj_id in obj_ids:
try:
api.lbaas.pool_health_monitor_delete(request, obj_id)
except:
except Exception:
exceptions.handle(request,
_('Unable to delete monitor.'))
if m == 'pool':
for obj_id in obj_ids:
try:
api.lbaas.pool_delete(request, obj_id)
except:
except Exception:
exceptions.handle(request,
_('Must delete VIP first.'))
if m == 'member':
for obj_id in obj_ids:
try:
api.lbaas.member_delete(request, obj_id)
except:
except Exception:
exceptions.handle(request,
_('Unable to delete member.'))
if m == 'vip':
for obj_id in obj_ids:
try:
vip_id = api.lbaas.pool_get(request, obj_id).vip_id
except:
except Exception:
exceptions.handle(request,
_('Unable to locate VIP to delete.'))
if vip_id is not None:
try:
api.lbaas.vip_delete(request, vip_id)
except:
except Exception:
exceptions.handle(request,
_('Unable to delete VIP.'))
return self.get(request, *args, **kwargs)
@ -130,7 +130,7 @@ class AddVipView(workflows.WorkflowView):
pool = api.lbaas.pool_get(self.request, initial['pool_id'])
initial['subnet'] = api.neutron.subnet_get(
self.request, pool.subnet_id).cidr
except:
except Exception:
initial['subnet'] = ''
msg = _('Unable to retrieve pool subnet.')
exceptions.handle(self.request, msg)
@ -189,7 +189,7 @@ class UpdatePoolView(forms.ModalFormView):
pool_id = self.kwargs['pool_id']
try:
self._object = api.lbaas.pool_get(self.request, pool_id)
except:
except Exception:
redirect = self.success_url
msg = _('Unable to retrieve pool details.')
exceptions.handle(self.request, msg, redirect=redirect)
@ -220,7 +220,7 @@ class UpdateVipView(forms.ModalFormView):
vip_id = self.kwargs['vip_id']
try:
self._object = api.lbaas.vip_get(self.request, vip_id)
except:
except Exception:
redirect = self.success_url
msg = _('Unable to retrieve vip details.')
exceptions.handle(self.request, msg, redirect=redirect)
@ -260,7 +260,7 @@ class UpdateMemberView(forms.ModalFormView):
member_id = self.kwargs['member_id']
try:
self._object = api.lbaas.member_get(self.request, member_id)
except:
except Exception:
redirect = self.success_url
msg = _('Unable to retrieve member details.')
exceptions.handle(self.request, msg, redirect=redirect)
@ -291,7 +291,7 @@ class UpdateMonitorView(forms.ModalFormView):
try:
self._object = api.lbaas.pool_health_monitor_get(
self.request, monitor_id)
except:
except Exception:
redirect = self.success_url
msg = _('Unable to retrieve health monitor details.')
exceptions.handle(self.request, msg, redirect=redirect)
@ -316,7 +316,7 @@ class AddPMAssociationView(workflows.WorkflowView):
pool = api.lbaas.pool_get(self.request, initial['pool_id'])
initial['pool_name'] = pool.name
initial['pool_monitors'] = pool.health_monitors
except:
except Exception:
msg = _('Unable to retrieve pool.')
exceptions.handle(self.request, msg)
return initial
@ -332,7 +332,7 @@ class DeletePMAssociationView(workflows.WorkflowView):
pool = api.lbaas.pool_get(self.request, initial['pool_id'])
initial['pool_name'] = pool.name
initial['pool_monitors'] = pool.health_monitors
except:
except Exception:
msg = _('Unable to retrieve pool.')
exceptions.handle(self.request, msg)
return initial

View File

@ -49,7 +49,7 @@ class AddPoolAction(workflows.Action):
subnet_id_choices = [('', _("Select a Subnet"))]
try:
networks = api.neutron.network_list_for_tenant(request, tenant_id)
except:
except Exception:
exceptions.handle(request,
_('Unable to retrieve networks list.'))
networks = []
@ -109,7 +109,7 @@ class AddPool(workflows.Workflow):
try:
api.lbaas.pool_create(request, **context)
return True
except:
except Exception:
return False
@ -225,7 +225,7 @@ class AddVip(workflows.Workflow):
try:
pool = api.lbaas.pool_get(request, context['pool_id'])
context['subnet_id'] = pool['subnet_id']
except:
except Exception:
context['subnet_id'] = None
self.failure_message = _('Unable to retrieve the specified pool. '
'Unable to add VIP "%s".')
@ -245,7 +245,7 @@ class AddVip(workflows.Workflow):
try:
api.lbaas.vip_create(request, **context)
return True
except:
except Exception:
return False
@ -275,7 +275,7 @@ class AddMemberAction(workflows.Action):
pool_id_choices = [('', _("Select a Pool"))]
try:
pools = api.lbaas.pools_get(request)
except:
except Exception:
pools = []
exceptions.handle(request,
_('Unable to retrieve pools list.'))
@ -288,7 +288,7 @@ class AddMemberAction(workflows.Action):
members_choices = []
try:
servers, has_more = api.nova.server_list(request)
except:
except Exception:
servers = []
exceptions.handle(request,
_('Unable to retrieve instances list.'))
@ -345,14 +345,14 @@ class AddMember(workflows.Workflow):
params = {'device_id': m}
try:
plist = api.neutron.port_list(request, **params)
except:
except Exception:
return False
if plist:
context['address'] = plist[0].fixed_ips[0]['ip_address']
try:
context['member_id'] = api.lbaas.member_create(
request, **context).id
except:
except Exception:
return False
return True
@ -486,7 +486,7 @@ class AddMonitor(workflows.Workflow):
context['monitor_id'] = api.lbaas.pool_health_monitor_create(
request, **context).get('id')
return True
except:
except Exception:
exceptions.handle(request, _("Unable to add monitor."))
return False
@ -507,7 +507,7 @@ class AddPMAssociationAction(workflows.Action):
for m in monitors:
if m.id not in context['pool_monitors']:
monitor_id_choices.append((m.id, m.id))
except:
except Exception:
exceptions.handle(request,
_('Unable to retrieve monitors list.'))
self.fields['monitor_id'].choices = monitor_id_choices
@ -545,7 +545,7 @@ class AddPMAssociation(workflows.Workflow):
context['monitor_id'] = api.lbaas.pool_monitor_association_create(
request, **context)
return True
except:
except Exception:
exceptions.handle(request, _("Unable to add association."))
return False
@ -565,7 +565,7 @@ class DeletePMAssociationAction(workflows.Action):
try:
for m_id in context['pool_monitors']:
monitor_id_choices.append((m_id, m_id))
except:
except Exception:
exceptions.handle(request,
_('Unable to retrieve monitors list.'))
self.fields['monitor_id'].choices = monitor_id_choices
@ -604,6 +604,6 @@ class DeletePMAssociation(workflows.Workflow):
context['monitor_id'] = api.lbaas.pool_monitor_association_delete(
request, **context)
return True
except:
except Exception:
exceptions.handle(request, _("Unable to delete association."))
return False

View File

@ -53,7 +53,7 @@ class JSONView(View):
# Get nova data
try:
servers, more = api.nova.server_list(request)
except:
except Exception:
servers = []
data['servers'] = [{'name': server.name,
'status': server.status,
@ -73,7 +73,7 @@ class JSONView(View):
tenant_id=request.user.tenant_id)
neutron_routers = api.neutron.router_list(request,
tenant_id=request.user.tenant_id)
except:
except Exception:
neutron_public_networks = []
neutron_networks = []
neutron_subnets = []

View File

@ -52,7 +52,7 @@ class UpdateNetwork(forms.SelfHandlingForm):
LOG.debug(msg)
messages.success(request, msg)
return network
except:
except Exception:
msg = _('Failed to update network %s') % data['name']
LOG.info(msg)
redirect = reverse(self.failure_url)

View File

@ -37,7 +37,7 @@ class OverviewTab(tabs.Tab):
port_id = self.tab_group.kwargs['port_id']
try:
port = api.neutron.port_get(self.request, port_id)
except:
except Exception:
redirect = reverse('horizon:project:networks:index')
msg = _('Unable to retrieve port details.')
exceptions.handle(request, msg, redirect=redirect)

View File

@ -49,7 +49,7 @@ class UpdateView(forms.ModalFormView):
port_id = self.kwargs['port_id']
try:
self._object = api.neutron.port_get(self.request, port_id)
except:
except Exception:
redirect = reverse("horizon:project:networks:detail",
args=(self.kwargs['network_id'],))
msg = _('Unable to retrieve port details')

View File

@ -48,7 +48,7 @@ class DeleteSubnet(CheckNetworkEditable, tables.DeleteAction):
def delete(self, request, obj_id):
try:
api.neutron.subnet_delete(request, obj_id)
except:
except Exception:
msg = _('Failed to delete subnet %s') % obj_id
LOG.info(msg)
network_id = self.table.kwargs['network_id']
@ -93,7 +93,7 @@ class SubnetsTable(tables.DataTable):
network_id = self.kwargs['network_id']
network = api.neutron.network_get(self.request, network_id)
network.set_id_as_name_if_empty(length=0)
except:
except Exception:
msg = _('Unable to retrieve details for network "%s".') \
% (network_id)
exceptions.handle(self.request, msg, redirect=self.failure_url)

View File

@ -37,7 +37,7 @@ class OverviewTab(tabs.Tab):
subnet_id = self.tab_group.kwargs['subnet_id']
try:
subnet = api.neutron.subnet_get(self.request, subnet_id)
except:
except Exception:
redirect = reverse('horizon:project:networks:index')
msg = _('Unable to retrieve subnet details.')
exceptions.handle(request, msg, redirect=redirect)

View File

@ -49,7 +49,7 @@ class CreateView(workflows.WorkflowView):
self._object = api.neutron.network_get(self.request,
network_id)
self._object.set_id_as_name_if_empty()
except:
except Exception:
redirect = reverse('horizon:project:networks:index')
msg = _("Unable to retrieve network.")
exceptions.handle(self.request, msg, redirect=redirect)
@ -69,7 +69,7 @@ class UpdateView(workflows.WorkflowView):
subnet_id = self.kwargs['subnet_id']
try:
self._object = api.neutron.subnet_get(self.request, subnet_id)
except:
except Exception:
redirect = reverse("horizon:project:networks:index")
msg = _('Unable to retrieve subnet details')
exceptions.handle(self.request, msg, redirect=redirect)

View File

@ -55,7 +55,7 @@ class DeleteNetwork(CheckNetworkEditable, tables.DeleteAction):
api.neutron.network_delete(request, network_id)
LOG.debug('Deleted network %s successfully' % network_id)
except:
except Exception:
msg = _('Failed to delete network %s') % network_id
LOG.info(msg)
redirect = reverse("horizon:project:networks:index")

View File

@ -52,7 +52,7 @@ class IndexView(tables.DataTableView):
tenant_id = self.request.user.tenant_id
networks = api.neutron.network_list_for_tenant(self.request,
tenant_id)
except:
except Exception:
networks = []
msg = _('Network list can not be retrieved.')
exceptions.handle(self.request, msg)
@ -85,7 +85,7 @@ class UpdateView(forms.ModalFormView):
try:
self._object = api.neutron.network_get(self.request,
network_id)
except:
except Exception:
redirect = self.success_url
msg = _('Unable to retrieve network details.')
exceptions.handle(self.request, msg, redirect=redirect)
@ -109,7 +109,7 @@ class DetailView(tables.MultiTableView):
network = self._get_data()
subnets = api.neutron.subnet_list(self.request,
network_id=network.id)
except:
except Exception:
subnets = []
msg = _('Subnet list can not be retrieved.')
exceptions.handle(self.request, msg)
@ -121,7 +121,7 @@ class DetailView(tables.MultiTableView):
try:
network_id = self.kwargs['network_id']
ports = api.neutron.port_list(self.request, network_id=network_id)
except:
except Exception:
ports = []
msg = _('Port list can not be retrieved.')
exceptions.handle(self.request, msg)
@ -135,7 +135,7 @@ class DetailView(tables.MultiTableView):
network_id = self.kwargs['network_id']
network = api.neutron.network_get(self.request, network_id)
network.set_id_as_name_if_empty(length=0)
except:
except Exception:
msg = _('Unable to retrieve details for network "%s".') \
% (network_id)
exceptions.handle(self.request, msg, redirect=self.failure_url)

View File

@ -351,7 +351,7 @@ class CreateNetwork(workflows.Workflow):
messages.info(request, msg)
raise exceptions.Http302(redirect)
#return exceptions.RecoverableError
except:
except Exception:
msg = _('Failed to delete network "%s"') % network.name
LOG.info(msg)
redirect = self.get_failure_url()

View File

@ -33,7 +33,7 @@ class CreateForm(forms.SelfHandlingForm):
message = _('Router %s was successfully created.') % data['name']
messages.success(request, message)
return router
except:
except Exception:
msg = _('Failed to create router "%s".') % data['name']
LOG.info(msg)
redirect = reverse(self.failure_url)

View File

@ -96,7 +96,7 @@ class AddInterface(forms.SelfHandlingForm):
self._handle_error(request, router_id, e)
try:
port = api.neutron.port_get(request, router_inf['port_id'])
except:
except Exception:
# Ignore an error when port_get() since it is just
# to get an IP address for the interface.
port = None
@ -107,7 +107,7 @@ class AddInterface(forms.SelfHandlingForm):
subnet_id = data['subnet_id']
try:
subnet = api.neutron.subnet_get(request, subnet_id)
except:
except Exception:
msg = _('Unable to get subnet "%s"') % subnet_id
self._handle_error(request, router_id, msg)
try:
@ -135,7 +135,7 @@ class AddInterface(forms.SelfHandlingForm):
def _delete_port(self, request, port):
try:
api.neutron.port_delete(request, port.id)
except:
except Exception:
msg = _('Failed to delete port %s') % port.id
LOG.info(msg)
exceptions.handle(request, msg)

View File

@ -63,7 +63,7 @@ class RemoveInterface(tables.DeleteAction):
api.neutron.router_remove_interface(request,
router_id,
port_id=obj_id)
except:
except Exception:
msg = _('Failed to delete interface %s') % obj_id
LOG.info(msg)
router_id = self.table.kwargs['router_id']

View File

@ -35,7 +35,7 @@ class OverviewTab(tabs.Tab):
port_id = self.tab_group.kwargs['port_id']
try:
port = api.neutron.port_get(self.request, port_id)
except:
except Exception:
redirect = reverse(self.failure_url)
msg = _('Unable to retrieve port details.')
exceptions.handle(request, msg, redirect=redirect)

View File

@ -51,7 +51,7 @@ class AddInterfaceView(forms.ModalFormView):
router_id = self.kwargs["router_id"]
self._object = api.neutron.router_get(self.request,
router_id)
except:
except Exception:
redirect = reverse(self.failure_url, args=[router_id])
msg = _("Unable to retrieve router.")
exceptions.handle(self.request, msg, redirect=redirect)
@ -83,7 +83,7 @@ class SetGatewayView(forms.ModalFormView):
router_id = self.kwargs["router_id"]
self._object = api.neutron.router_get(self.request,
router_id)
except:
except Exception:
redirect = reverse(self.failure_url)
msg = _("Unable to set gateway.")
exceptions.handle(self.request, msg, redirect=redirect)

View File

@ -32,7 +32,7 @@ class OverviewTab(tabs.Tab):
router_id = self.tab_group.kwargs['router_id']
try:
router = api.neutron.router_get(request, router_id)
except:
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve router details.'),
redirect=reverse(self.redirect_url))

View File

@ -48,7 +48,7 @@ class IndexView(tables.DataTableView):
routers = api.neutron.router_list(self.request,
tenant_id=tenant_id,
search_opts=search_opts)
except:
except Exception:
routers = []
exceptions.handle(self.request,
_('Unable to retrieve router list.'))
@ -100,7 +100,7 @@ class DetailView(tables.MultiTableView):
router_id = self.kwargs['router_id']
router = api.neutron.router_get(self.request, router_id)
router.set_id_as_name_if_empty(length=0)
except:
except Exception:
msg = _('Unable to retrieve details for router "%s".') \
% (router_id)
exceptions.handle(self.request, msg, redirect=self.failure_url)
@ -131,7 +131,7 @@ class DetailView(tables.MultiTableView):
device_id = self.kwargs['router_id']
ports = api.neutron.port_list(self.request,
device_id=device_id)
except:
except Exception:
ports = []
msg = _('Port list can not be retrieved.')
exceptions.handle(self.request, msg)

View File

@ -22,7 +22,7 @@ class Stack(object):
def d3_data(request, stack_id=''):
try:
stack = stack_get(request, stack_id)
except:
except Exception:
stack = Stack()
stack.id = stack_id
stack.stack_name = request.session.get('stack_name', '')
@ -31,7 +31,7 @@ def d3_data(request, stack_id=''):
try:
resources = resources_list(request, stack.stack_name)
except:
except Exception:
resources = []
d3_data = {"nodes": [], "stack": {}}

View File

@ -74,7 +74,7 @@ class StackEventsTab(tabs.Tab):
stack_identifier = '%s/%s' % (stack.stack_name, stack.id)
events = api.heat.events_list(self.request, stack_identifier)
LOG.debug('got events %s' % events)
except:
except Exception:
events = []
messages.error(request, _(
'Unable to get events for stack "%s".') % stack.stack_name)
@ -94,7 +94,7 @@ class StackResourcesTab(tabs.Tab):
stack_identifier = '%s/%s' % (stack.stack_name, stack.id)
resources = api.heat.resources_list(self.request, stack_identifier)
LOG.debug('got resources %s' % resources)
except:
except Exception:
resources = []
messages.error(request, _(
'Unable to get resources for stack "%s".') % stack.stack_name)

View File

@ -48,7 +48,7 @@ class IndexView(tables.DataTableView):
request = self.request
try:
stacks = api.heat.stacks_list(self.request)
except:
except Exception:
exceptions.handle(request, _('Unable to retrieve stack list.'))
stacks = []
return stacks
@ -107,7 +107,7 @@ class DetailView(tabs.TabView):
self._stack = stack
request.session['stack_id'] = stack.id
request.session['stack_name'] = stack.stack_name
except:
except Exception:
msg = _("Unable to retrieve stack.")
redirect = reverse('horizon:project:stacks:index')
exceptions.handle(request, msg, redirect=redirect)
@ -136,7 +136,7 @@ class ResourceView(tabs.TabView):
kwargs['stack_id'],
kwargs['resource_name'])
self._resource = resource
except:
except Exception:
msg = _("Unable to retrieve resource.")
redirect = reverse('horizon:project:stacks:index')
exceptions.handle(request, msg, redirect=redirect)
@ -150,7 +150,7 @@ class ResourceView(tabs.TabView):
kwargs['stack_id'],
kwargs['resource_name'])
self._metadata = json.dumps(metadata, indent=2)
except:
except Exception:
msg = _("Unable to retrieve metadata.")
redirect = reverse('horizon:project:stacks:index')
exceptions.handle(request, msg, redirect=redirect)

View File

@ -95,14 +95,14 @@ class CreateForm(forms.SelfHandlingForm):
orig_volume = cinder.volume_get(request,
snapshot.volume_id)
self.fields['type'].initial = orig_volume.volume_type
except:
except Exception:
pass
self.fields['size'].help_text = _('Volume size must be equal '
'to or greater than the snapshot size (%sGB)'
% snapshot.size)
del self.fields['image_source']
del self.fields['volume_source_type']
except:
except Exception:
exceptions.handle(request,
_('Unable to load the specified snapshot.'))
elif ('image_id' in request.GET):
@ -118,7 +118,7 @@ class CreateForm(forms.SelfHandlingForm):
% filesizeformat(image.size))
del self.fields['snapshot_source']
del self.fields['volume_source_type']
except:
except Exception:
msg = _('Unable to load the specified image. %s')
exceptions.handle(request, msg % request.GET['image_id'])
else:
@ -134,7 +134,7 @@ class CreateForm(forms.SelfHandlingForm):
self.fields['snapshot_source'].choices = choices
else:
del self.fields['snapshot_source']
except:
except Exception:
exceptions.handle(request, _("Unable to retrieve "
"volume snapshots."))
@ -236,7 +236,7 @@ class CreateForm(forms.SelfHandlingForm):
except ValidationError as e:
self.api_error(e.messages[0])
return False
except:
except Exception:
exceptions.handle(request, ignore=True)
self.api_error(_("Unable to create volume."))
return False
@ -316,7 +316,7 @@ class AttachForm(forms.SelfHandlingForm):
"dev": attach.device}
messages.info(request, message)
return True
except:
except Exception:
redirect = reverse("horizon:project:volumes:index")
exceptions.handle(request,
_('Unable to attach volume.'),
@ -346,7 +346,7 @@ class CreateSnapshotForm(forms.SelfHandlingForm):
message = _('Creating volume snapshot "%s"') % data['name']
messages.info(request, message)
return snapshot
except:
except Exception:
redirect = reverse("horizon:project:images_and_snapshots:index")
exceptions.handle(request,
_('Unable to create volume snapshot.'),

View File

@ -45,7 +45,7 @@ class DeleteVolume(tables.DeleteAction):
name = self.table.get_object_display(obj)
try:
cinder.volume_delete(request, obj_id)
except:
except Exception:
msg = _('Unable to delete volume "%s". One or more snapshots '
'depend on it.')
exceptions.check_message(["snapshots", "dependent"], msg % name)
@ -106,7 +106,7 @@ def get_attachment_name(request, attachment):
try:
server = api.nova.server_get(request, server_id)
name = server.name
except:
except Exception:
name = None
exceptions.handle(request, _("Unable to retrieve "
"attachment information."))

View File

@ -36,7 +36,7 @@ class OverviewTab(tabs.Tab):
volume = cinder.volume_get(request, volume_id)
for att in volume.attachments:
att['instance'] = nova.server_get(request, att['server_id'])
except:
except Exception:
redirect = reverse('horizon:project:volumes:index')
exceptions.handle(self.request,
_('Unable to retrieve volume details.'),

Some files were not shown because too many files have changed in this diff Show More