Browse Source

Merge "Ensure log messages are not translated"

Jenkins 2 years ago
parent
commit
30a00a0dc3
27 changed files with 223 additions and 189 deletions
  1. 12
    10
      horizon/notifications.py
  2. 3
    4
      horizon/tables/base.py
  3. 2
    2
      openstack_dashboard/api/microversions.py
  4. 13
    15
      openstack_dashboard/api/neutron.py
  5. 2
    2
      openstack_dashboard/api/nova.py
  6. 1
    1
      openstack_dashboard/dashboards/admin/networks/agents/tables.py
  7. 4
    4
      openstack_dashboard/dashboards/admin/networks/forms.py
  8. 9
    9
      openstack_dashboard/dashboards/admin/networks/ports/forms.py
  9. 3
    2
      openstack_dashboard/dashboards/admin/networks/subnets/tables.py
  10. 3
    2
      openstack_dashboard/dashboards/admin/networks/subnets/workflows.py
  11. 3
    2
      openstack_dashboard/dashboards/admin/networks/tables.py
  12. 1
    1
      openstack_dashboard/dashboards/identity/identity_providers/protocols/forms.py
  13. 88
    69
      openstack_dashboard/dashboards/project/firewalls/forms.py
  14. 2
    3
      openstack_dashboard/dashboards/project/firewalls/tables.py
  15. 3
    3
      openstack_dashboard/dashboards/project/networks/forms.py
  16. 8
    8
      openstack_dashboard/dashboards/project/networks/ports/forms.py
  17. 4
    3
      openstack_dashboard/dashboards/project/networks/ports/tables.py
  18. 3
    2
      openstack_dashboard/dashboards/project/networks/subnets/tables.py
  19. 3
    2
      openstack_dashboard/dashboards/project/networks/tables.py
  20. 6
    4
      openstack_dashboard/dashboards/project/networks/workflows.py
  21. 5
    5
      openstack_dashboard/dashboards/project/routers/extensions/extraroutes/forms.py
  22. 3
    3
      openstack_dashboard/dashboards/project/routers/extensions/extraroutes/tabs.py
  23. 6
    6
      openstack_dashboard/dashboards/project/routers/forms.py
  24. 12
    12
      openstack_dashboard/dashboards/project/routers/ports/forms.py
  25. 3
    2
      openstack_dashboard/dashboards/project/routers/ports/tables.py
  26. 13
    5
      openstack_dashboard/dashboards/project/routers/tables.py
  27. 8
    8
      openstack_dashboard/dashboards/project/vpn/forms.py

+ 12
- 10
horizon/notifications.py View File

@@ -66,13 +66,14 @@ class JSONMessage(object):
66 66
         except ValueError as exc:
67 67
             self.failed = True
68 68
 
69
-            msg = _("Message json file '%(path)s' is malformed."
70
-                    " %(exception)s")
71
-            msg = msg % {'path': self._path, 'exception': str(exc)}
69
+            params = {'path': self._path, 'exception': exc}
72 70
             if self.fail_silently:
73
-                LOG.warning(msg)
71
+                LOG.warning("Message json file '%(path)s' is malformed. "
72
+                            "%(exception)s", params)
74 73
             else:
75
-                raise exceptions.MessageFailure(msg)
74
+                raise exceptions.MessageFailure(
75
+                    _("Message json file '%(path)s' is malformed. "
76
+                      "%(exception)s") % params)
76 77
         else:
77 78
             level_name = attrs.get('level', 'info')
78 79
             if level_name in self.MESSAGE_LEVELS:
@@ -89,13 +90,14 @@ class JSONMessage(object):
89 90
         except Exception as exc:
90 91
             self.failed = True
91 92
 
92
-            msg = _("Error processing message json file '%(path)s': "
93
-                    "%(exception)s")
94
-            msg = msg % {'path': self._path, 'exception': str(exc)}
93
+            params = {'path': self._path, 'exception': exc}
95 94
             if self.fail_silently:
96
-                LOG.warning(msg)
95
+                LOG.warning("Error processing message json file '%(path)s': "
96
+                            "%(exception)s", params)
97 97
             else:
98
-                raise exceptions.MessageFailure(msg)
98
+                raise exceptions.MessageFailure(
99
+                    _("Error processing message json file '%(path)s': "
100
+                      "%(exception)s") % params)
99 101
 
100 102
     def send_message(self, request):
101 103
         if self.failed:

+ 3
- 4
horizon/tables/base.py View File

@@ -391,10 +391,9 @@ class Column(html.HTMLElement):
391 391
             # Basic object lookups
392 392
             data = getattr(datum, self.transform, None)
393 393
             if not hasattr(datum, self.transform):
394
-                msg = _("The attribute %(attr)s doesn't exist on "
395
-                        "%(obj)s.") % {'attr': self.transform, 'obj': datum}
396
-                msg = termcolors.colorize(msg, **PALETTE['ERROR'])
397
-                LOG.debug(msg)
394
+                msg = "The attribute %(attr)s doesn't exist on %(obj)s."
395
+                LOG.debug(termcolors.colorize(msg, **PALETTE['ERROR']),
396
+                          {'attr': self.transform, 'obj': datum})
398 397
         return data
399 398
 
400 399
     def get_data(self, datum):

+ 2
- 2
openstack_dashboard/api/microversions.py View File

@@ -45,8 +45,8 @@ def get_microversion_for_feature(service, feature, wrapper_class,
45 45
     try:
46 46
         service_features = MICROVERSION_FEATURES[service]
47 47
     except KeyError:
48
-        LOG.debug("'%s' could not be found in the MICROVERSION_FEATURES "
49
-                  "dict" % service)
48
+        LOG.debug("'%s' could not be found in the MICROVERSION_FEATURES dict",
49
+                  service)
50 50
         return None
51 51
     feature_versions = service_features[feature]
52 52
     for version in reversed(feature_versions):

+ 13
- 15
openstack_dashboard/api/neutron.py View File

@@ -1123,9 +1123,9 @@ def servers_update_addresses(request, servers, all_tenants=False):
1123 1123
         networks = list_resources_with_long_filters(
1124 1124
             network_list, 'id', set([port.network_id for port in ports]),
1125 1125
             request=request)
1126
-    except Exception:
1126
+    except Exception as e:
1127
+        LOG.error('Unable to connect to Neutron: %s', e)
1127 1128
         error_message = _('Unable to connect to Neutron.')
1128
-        LOG.error(error_message)
1129 1129
         messages.error(request, error_message)
1130 1130
         return
1131 1131
 
@@ -1160,9 +1160,10 @@ def _server_get_addresses(request, server, ports, floating_ips, network_names):
1160 1160
     def _format_address(mac, ip, type):
1161 1161
         try:
1162 1162
             version = netaddr.IPAddress(ip).version
1163
-        except Exception:
1163
+        except Exception as e:
1164
+            LOG.error('Unable to parse IP address %(ip)s: %(exc)s',
1165
+                      {'ip': ip, 'exc': e})
1164 1166
             error_message = _('Unable to parse IP address %s.') % ip
1165
-            LOG.error(error_message)
1166 1167
             messages.error(request, error_message)
1167 1168
             raise
1168 1169
         return {u'OS-EXT-IPS-MAC:mac_addr': mac,
@@ -1283,10 +1284,9 @@ def get_feature_permission(request, feature, operation=None):
1283 1284
     network_config = getattr(settings, 'OPENSTACK_NEUTRON_NETWORK', {})
1284 1285
     feature_info = FEATURE_MAP.get(feature)
1285 1286
     if not feature_info:
1286
-        # Translators: Only used inside Horizon code and invisible to users
1287
-        raise ValueError(_("The requested feature '%(feature)s' is unknown. "
1288
-                           "Please make sure to specify a feature defined "
1289
-                           "in FEATURE_MAP."))
1287
+        raise ValueError("The requested feature '%(feature)s' is unknown. "
1288
+                         "Please make sure to specify a feature defined "
1289
+                         "in FEATURE_MAP.")
1290 1290
 
1291 1291
     # Check dashboard settings
1292 1292
     feature_config = feature_info.get('config')
@@ -1300,10 +1300,9 @@ def get_feature_permission(request, feature, operation=None):
1300 1300
     if feature_policies:
1301 1301
         policy_name = feature_policies.get(operation)
1302 1302
         if not policy_name:
1303
-            # Translators: Only used inside Horizon code and invisible to users
1304
-            raise ValueError(_("The 'operation' parameter for "
1305
-                               "get_feature_permission '%(feature)s' "
1306
-                               "is invalid. It should be one of %(allowed)s")
1303
+            raise ValueError("The 'operation' parameter for "
1304
+                             "get_feature_permission '%(feature)s' "
1305
+                             "is invalid. It should be one of %(allowed)s"
1307 1306
                              % {'feature': feature,
1308 1307
                                 'allowed': ' '.join(feature_policies.keys())})
1309 1308
         role = (('network', policy_name),)
@@ -1316,9 +1315,8 @@ def get_feature_permission(request, feature, operation=None):
1316 1315
         try:
1317 1316
             return is_extension_supported(request, feature_extension)
1318 1317
         except Exception:
1319
-            msg = (_("Failed to check Neutron '%s' extension is not supported")
1320
-                   % feature_extension)
1321
-            LOG.info(msg)
1318
+            LOG.info("Failed to check Neutron '%s' extension is not supported",
1319
+                     feature_extension)
1322 1320
             return False
1323 1321
 
1324 1322
     # If all checks are passed, now a given feature is allowed.

+ 2
- 2
openstack_dashboard/api/nova.py View File

@@ -349,8 +349,8 @@ class SecurityGroupManager(network_base.SecurityGroupManager):
349 349
                 self.client.servers.remove_security_group(instance_id, group)
350 350
                 num_groups_to_modify -= 1
351 351
         except nova_exceptions.ClientException as err:
352
-            LOG.error(_("Failed to modify %(num_groups_to_modify)d instance "
353
-                        "security groups: %(err)s"),
352
+            LOG.error("Failed to modify %(num_groups_to_modify)d instance "
353
+                      "security groups: %(err)s",
354 354
                       {'num_groups_to_modify': num_groups_to_modify,
355 355
                        'err': err})
356 356
             # reraise novaclient.exceptions.ClientException, but with

+ 1
- 1
openstack_dashboard/dashboards/admin/networks/agents/tables.py View File

@@ -54,8 +54,8 @@ class DeleteDHCPAgent(tables.DeleteAction):
54 54
             api.neutron.remove_network_from_dhcp_agent(request, obj_id,
55 55
                                                        network_id)
56 56
         except Exception as e:
57
+            LOG.info('Failed to delete agent: %s', e)
57 58
             msg = _('Failed to delete agent: %s') % e
58
-            LOG.info(msg)
59 59
             redirect = reverse('horizon:admin:networks:detail',
60 60
                                args=[network_id])
61 61
             exceptions.handle(request, msg, redirect=redirect)

+ 4
- 4
openstack_dashboard/dashboards/admin/networks/forms.py View File

@@ -262,7 +262,7 @@ class CreateNetwork(forms.SelfHandlingForm):
262 262
                     params['provider:segmentation_id'] = (
263 263
                         data['segmentation_id'])
264 264
             network = api.neutron.network_create(request, **params)
265
-            LOG.debug(_('Network %s was successfully created.'), data['name'])
265
+            LOG.debug('Network %s was successfully created.', data['name'])
266 266
             return network
267 267
         except Exception:
268 268
             redirect = reverse('horizon:admin:networks:index')
@@ -327,11 +327,11 @@ class UpdateNetwork(forms.SelfHandlingForm):
327 327
                                                  self.initial['network_id'],
328 328
                                                  **params)
329 329
             msg = _('Network %s was successfully updated.') % data['name']
330
-            LOG.debug(msg)
331 330
             messages.success(request, msg)
332 331
             return network
333
-        except Exception:
332
+        except Exception as e:
333
+            LOG.info('Failed to update network %(id)s: %(exc)s',
334
+                     {'id': self.initial['network_id'], 'exc': e})
334 335
             msg = _('Failed to update network %s') % data['name']
335
-            LOG.info(msg)
336 336
             redirect = reverse(self.failure_url)
337 337
             exceptions.handle(request, msg, redirect=redirect)

+ 9
- 9
openstack_dashboard/dashboards/admin/networks/ports/forms.py View File

@@ -127,15 +127,15 @@ class CreatePort(project_forms.CreatePort):
127 127
 
128 128
             port = api.neutron.port_create(request, **params)
129 129
             msg = _('Port %s was successfully created.') % port['id']
130
-            LOG.debug(msg)
131 130
             messages.success(request, msg)
132 131
             return port
133
-        except Exception:
134
-            msg = _('Failed to create a port for network %s') \
135
-                % data['network_id']
136
-            LOG.info(msg)
132
+        except Exception as e:
133
+            net_id = data['network_id']
134
+            LOG.info('Failed to create a port for network %(id)s: %(exc)s',
135
+                     {'id': net_id, 'exc': e})
136
+            msg = _('Failed to create a port for network %s') % net_id
137 137
             redirect = reverse(self.failure_url,
138
-                               args=(data['network_id'],))
138
+                               args=(net_id,))
139 139
             exceptions.handle(request, msg, redirect=redirect)
140 140
 
141 141
 
@@ -187,12 +187,12 @@ class UpdatePort(project_forms.UpdatePort):
187 187
                                            mac_address=data['mac_address'],
188 188
                                            **extension_kwargs)
189 189
             msg = _('Port %s was successfully updated.') % data['port_id']
190
-            LOG.debug(msg)
191 190
             messages.success(request, msg)
192 191
             return port
193
-        except Exception:
192
+        except Exception as e:
193
+            LOG.info('Failed to update port %(id)s: %(exc)s',
194
+                     {'id': data['port_id'], 'exc': e})
194 195
             msg = _('Failed to update port %s') % data['port_id']
195
-            LOG.info(msg)
196 196
             redirect = reverse(self.failure_url,
197 197
                                args=[data['network_id']])
198 198
             exceptions.handle(request, msg, redirect=redirect)

+ 3
- 2
openstack_dashboard/dashboards/admin/networks/subnets/tables.py View File

@@ -54,9 +54,10 @@ class DeleteSubnet(proj_tables.SubnetPolicyTargetMixin, tables.DeleteAction):
54 54
     def delete(self, request, obj_id):
55 55
         try:
56 56
             api.neutron.subnet_delete(request, obj_id)
57
-        except Exception:
57
+        except Exception as e:
58
+            LOG.info('Failed to delete subnet %(id)s: %(exc)s',
59
+                     {'id': obj_id, 'exc': e})
58 60
             msg = _('Failed to delete subnet %s') % obj_id
59
-            LOG.info(msg)
60 61
             network_id = self.table.kwargs['network_id']
61 62
             redirect = reverse('horizon:admin:networks:detail',
62 63
                                args=[network_id])

+ 3
- 2
openstack_dashboard/dashboards/admin/networks/subnets/workflows.py View File

@@ -64,10 +64,11 @@ class CreateSubnet(project_workflows.CreateSubnet):
64 64
             # created for if admin user does not belong to the tenant.
65 65
             network = api.neutron.network_get(request,
66 66
                                               self.context['network_id'])
67
-        except Exception:
67
+        except Exception as e:
68
+            LOG.info('Failed to retrieve network %(id)s for a subnet: %(exc)s',
69
+                     {'id': data['network_id'], 'exc': e})
68 70
             msg = (_('Failed to retrieve network %s for a subnet') %
69 71
                    data['network_id'])
70
-            LOG.info(msg)
71 72
             redirect = self.get_failure_url()
72 73
             exceptions.handle(request, msg, redirect=redirect)
73 74
         subnet = self._create_subnet(request, data,

+ 3
- 2
openstack_dashboard/dashboards/admin/networks/tables.py View File

@@ -53,9 +53,10 @@ class DeleteNetwork(policy.PolicyTargetMixin, tables.DeleteAction):
53 53
     def delete(self, request, obj_id):
54 54
         try:
55 55
             api.neutron.network_delete(request, obj_id)
56
-        except Exception:
56
+        except Exception as e:
57
+            LOG.info('Failed to delete network %(id)s: %(exc)s',
58
+                     {'id': obj_id, 'exc': e})
57 59
             msg = _('Failed to delete network %s') % obj_id
58
-            LOG.info(msg)
59 60
             redirect = reverse('horizon:admin:networks:index')
60 61
             exceptions.handle(request, msg, redirect=redirect)
61 62
 

+ 1
- 1
openstack_dashboard/dashboards/identity/identity_providers/protocols/forms.py View File

@@ -40,8 +40,8 @@ class AddProtocolForm(forms.SelfHandlingForm):
40 40
         try:
41 41
             mappings = api.keystone.mapping_list(request)
42 42
         except Exception as e:
43
+            LOG.info('Failed to get mapping list %s', e)
43 44
             msg = _('Failed to get mapping list %s') % e
44
-            LOG.info(msg)
45 45
             messages.error(request, msg)
46 46
 
47 47
         choices = [(m.id, m.id) for m in mappings]

+ 88
- 69
openstack_dashboard/dashboards/project/firewalls/forms.py View File

@@ -12,7 +12,6 @@
12 12
 #    License for the specific language governing permissions and limitations
13 13
 #    under the License.
14 14
 
15
-import abc
16 15
 import logging
17 16
 
18 17
 from django.core.urlresolvers import reverse
@@ -89,13 +88,13 @@ class UpdateRule(forms.SelfHandlingForm):
89 88
         try:
90 89
             rule = api.fwaas.rule_update(request, rule_id, **context)
91 90
             msg = _('Rule %s was successfully updated.') % name_or_id
92
-            LOG.debug(msg)
93 91
             messages.success(request, msg)
94 92
             return rule
95 93
         except Exception as e:
94
+            LOG.error('Failed to update rule %(id)s: %(reason)s',
95
+                      {'id': rule_id, 'reason': e})
96 96
             msg = (_('Failed to update rule %(name)s: %(reason)s') %
97 97
                    {'name': name_or_id, 'reason': e})
98
-            LOG.error(msg)
99 98
             redirect = reverse(self.failure_url)
100 99
             exceptions.handle(request, msg, redirect=redirect)
101 100
 
@@ -115,13 +114,13 @@ class UpdatePolicy(forms.SelfHandlingForm):
115 114
         try:
116 115
             policy = api.fwaas.policy_update(request, policy_id, **context)
117 116
             msg = _('Policy %s was successfully updated.') % name_or_id
118
-            LOG.debug(msg)
119 117
             messages.success(request, msg)
120 118
             return policy
121 119
         except Exception as e:
122
-            msg = _('Failed to update policy %(name)s: %(reason)s') % {
123
-                'name': name_or_id, 'reason': e}
124
-            LOG.error(msg)
120
+            LOG.error('Failed to update policy %(id)s: %(reason)s',
121
+                      {'id': policy_id, 'reason': e})
122
+            msg = (_('Failed to update policy %(name)s: %(reason)s') %
123
+                   {'name': name_or_id, 'reason': e})
125 124
             redirect = reverse(self.failure_url)
126 125
             exceptions.handle(request, msg, redirect=redirect)
127 126
 
@@ -167,13 +166,13 @@ class UpdateFirewall(forms.SelfHandlingForm):
167 166
             firewall = api.fwaas.firewall_update(request, firewall_id,
168 167
                                                  **context)
169 168
             msg = _('Firewall %s was successfully updated.') % name_or_id
170
-            LOG.debug(msg)
171 169
             messages.success(request, msg)
172 170
             return firewall
173 171
         except Exception as e:
174
-            msg = _('Failed to update firewall %(name)s: %(reason)s') % {
175
-                'name': name_or_id, 'reason': e}
176
-            LOG.error(msg)
172
+            LOG.error('Failed to update firewall %(id)s: %(reason)s',
173
+                      {'id': firewall_id, 'reason': e})
174
+            msg = (_('Failed to update firewall %(name)s: %(reason)s') %
175
+                   {'name': name_or_id, 'reason': e})
177 176
             redirect = reverse(self.failure_url)
178 177
             exceptions.handle(request, msg, redirect=redirect)
179 178
 
@@ -207,8 +206,8 @@ class InsertRuleToPolicy(forms.SelfHandlingForm):
207 206
             current_choices = [(r.id, r.name_or_id) for r in current_rules]
208 207
 
209 208
         except Exception as e:
209
+            LOG.error('Failed to retrieve available rules: %s', e)
210 210
             msg = _('Failed to retrieve available rules: %s') % e
211
-            LOG.error(msg)
212 211
             redirect = reverse(self.failure_url)
213 212
             exceptions.handle(request, msg, redirect=redirect)
214 213
 
@@ -230,13 +229,13 @@ class InsertRuleToPolicy(forms.SelfHandlingForm):
230 229
                     '%(policy)s.') % {
231 230
                         'rule': insert_rule.name or insert_rule.id,
232 231
                         'policy': policy_name_or_id}
233
-            LOG.debug(msg)
234 232
             messages.success(request, msg)
235 233
             return policy
236 234
         except Exception as e:
237
-            msg = _('Failed to insert rule to policy %(name)s: %(reason)s') % {
238
-                'name': policy_id, 'reason': e}
239
-            LOG.error(msg)
235
+            LOG.error('Failed to insert rule to policy %(id)s: %(reason)s',
236
+                      {'id': policy_id, 'reason': e})
237
+            msg = (_('Failed to insert rule to policy %(name)s: %(reason)s') %
238
+                   {'name': policy_id, 'reason': e})
240 239
             redirect = reverse(self.failure_url)
241 240
             exceptions.handle(request, msg, redirect=redirect)
242 241
 
@@ -260,9 +259,12 @@ class RemoveRuleFromPolicy(forms.SelfHandlingForm):
260 259
 
261 260
             current_choices = [(r.id, r.name_or_id) for r in current_rules]
262 261
         except Exception as e:
263
-            msg = _('Failed to retrieve current rules in policy %(name)s: '
264
-                    '%(reason)s') % {'name': self.initial['name'], 'reason': e}
265
-            LOG.error(msg)
262
+            LOG.error('Failed to retrieve current rules in policy %(id)s: '
263
+                      '%(reason)s',
264
+                      {'id': self.initial['policy_id'], 'reason': e})
265
+            msg = (_('Failed to retrieve current rules in policy %(name)s: '
266
+                     '%(reason)s') %
267
+                   {'name': self.initial['name'], 'reason': e})
266 268
             redirect = reverse(self.failure_url)
267 269
             exceptions.handle(request, msg, redirect=redirect)
268 270
 
@@ -280,39 +282,47 @@ class RemoveRuleFromPolicy(forms.SelfHandlingForm):
280 282
                     '%(policy)s.') % {
281 283
                         'rule': remove_rule.name or remove_rule.id,
282 284
                         'policy': policy_name_or_id}
283
-            LOG.debug(msg)
284 285
             messages.success(request, msg)
285 286
             return policy
286 287
         except Exception as e:
287
-            msg = _('Failed to remove rule from policy %(name)s: '
288
-                    '%(reason)s') % {'name': self.initial['name'],
289
-                                     'reason': e}
290
-            LOG.error(msg)
288
+            LOG.error('Failed to remove rule from policy %(id)s: %(reason)s',
289
+                      {'id': policy_id, 'reason': e})
290
+            msg = (_('Failed to remove rule from policy %(name)s: %(reason)s')
291
+                   % {'name': self.initial['name'], 'reason': e})
291 292
             redirect = reverse(self.failure_url)
292 293
             exceptions.handle(request, msg, redirect=redirect)
293 294
 
294 295
 
295
-class RouterInsertionFormBase(forms.SelfHandlingForm):
296
+class AddRouterToFirewall(forms.SelfHandlingForm):
297
+    router_ids = forms.MultipleChoiceField(
298
+        label=_("Add Routers"),
299
+        required=False,
300
+        widget=forms.ThemableCheckboxSelectMultiple(),
301
+        help_text=_("Add selected router(s) to the firewall."))
302
+
303
+    failure_url = 'horizon:project:firewalls:index'
296 304
 
297 305
     def __init__(self, request, *args, **kwargs):
298
-        super(RouterInsertionFormBase, self).__init__(request, *args, **kwargs)
306
+        super(AddRouterToFirewall, self).__init__(request, *args, **kwargs)
299 307
         try:
300 308
             router_choices = self.get_router_choices(request, kwargs)
301 309
             self.fields['router_ids'].choices = router_choices
302 310
         except Exception as e:
303
-            msg = self.init_failure_msg % {'name': self.initial['name'],
304
-                                           'reason': e}
305
-            LOG.error(msg)
311
+            LOG.error('Failed to retrieve available routers: %s', e)
312
+            msg = _('Failed to retrieve available routers: %s') % e
306 313
             redirect = reverse(self.failure_url)
307 314
             exceptions.handle(request, msg, redirect=redirect)
308 315
 
309
-    @abc.abstractmethod
310 316
     def get_router_choices(self, request, kwargs):
311
-        """Return a list of selectable routers."""
317
+        tenant_id = self.request.user.tenant_id
318
+        routers_list = api.fwaas.firewall_unassociated_routers_list(
319
+            request, tenant_id)
320
+        return [(r.id, r.name_or_id) for r in routers_list]
312 321
 
313
-    @abc.abstractmethod
314 322
     def get_new_router_ids(self, context):
315
-        """Return a new list of router IDs associated with the firewall."""
323
+        existing_router_ids = self.initial['router_ids']
324
+        add_router_ids = context['router_ids']
325
+        return add_router_ids + existing_router_ids
316 326
 
317 327
     def handle(self, request, context):
318 328
         firewall_id = self.initial['firewall_id']
@@ -320,43 +330,22 @@ class RouterInsertionFormBase(forms.SelfHandlingForm):
320 330
         try:
321 331
             body = {'router_ids': self.get_new_router_ids(context)}
322 332
             firewall = api.fwaas.firewall_update(request, firewall_id, **body)
323
-            msg = self.success_msg % {'firewall': firewall_name_or_id}
324
-            LOG.debug(msg)
333
+            msg = (_('Router(s) was/were successfully added to firewall '
334
+                     '%(firewall)s.') %
335
+                   {'firewall': firewall_name_or_id})
325 336
             messages.success(request, msg)
326 337
             return firewall
327 338
         except Exception as e:
328
-            msg = self.failure_msg % {'name': firewall_name_or_id, 'reason': e}
329
-            LOG.error(msg)
339
+            LOG.error('Failed to add router(s) to firewall %(id)s: %(reason)s',
340
+                      {'id': firewall_id, 'reason': e})
341
+            msg = (_('Failed to add router(s) to firewall %(name)s: '
342
+                     '%(reason)s') %
343
+                   {'name': firewall_name_or_id, 'reason': e})
330 344
             redirect = reverse(self.failure_url)
331 345
             exceptions.handle(request, msg, redirect=redirect)
332 346
 
333 347
 
334
-class AddRouterToFirewall(RouterInsertionFormBase):
335
-    router_ids = forms.MultipleChoiceField(
336
-        label=_("Add Routers"),
337
-        required=False,
338
-        widget=forms.ThemableCheckboxSelectMultiple(),
339
-        help_text=_("Add selected router(s) to the firewall."))
340
-
341
-    failure_url = 'horizon:project:firewalls:index'
342
-    success_msg = _('Router(s) was/were successfully added to firewall '
343
-                    '%(firewall)s.')
344
-    failure_msg = _('Failed to add router(s) to firewall %(name)s: %(reason)s')
345
-    init_failure_msg = _('Failed to retrieve available routers: %(reason)s')
346
-
347
-    def get_router_choices(self, request, kwargs):
348
-        tenant_id = self.request.user.tenant_id
349
-        routers_list = api.fwaas.firewall_unassociated_routers_list(
350
-            request, tenant_id)
351
-        return [(r.id, r.name_or_id) for r in routers_list]
352
-
353
-    def get_new_router_ids(self, context):
354
-        existing_router_ids = self.initial['router_ids']
355
-        add_router_ids = context['router_ids']
356
-        return add_router_ids + existing_router_ids
357
-
358
-
359
-class RemoveRouterFromFirewall(RouterInsertionFormBase):
348
+class RemoveRouterFromFirewall(forms.SelfHandlingForm):
360 349
     router_ids = forms.MultipleChoiceField(
361 350
         label=_("Associated Routers"),
362 351
         required=False,
@@ -364,12 +353,22 @@ class RemoveRouterFromFirewall(RouterInsertionFormBase):
364 353
         help_text=_("Unselect the router(s) to be removed from firewall."))
365 354
 
366 355
     failure_url = 'horizon:project:firewalls:index'
367
-    success_msg = _('Router(s)  was successfully removed from firewall '
368
-                    '%(firewall)s.')
369
-    failure_msg = _('Failed to remove router(s) from firewall %(name)s: '
370
-                    '%(reason)s')
371
-    init_failure_msg = _('Failed to retrieve current routers in firewall '
372
-                         '%(name)s: %(reason)s')
356
+
357
+    def __init__(self, request, *args, **kwargs):
358
+        super(RemoveRouterFromFirewall, self).__init__(request,
359
+                                                       *args, **kwargs)
360
+        try:
361
+            router_choices = self.get_router_choices(request, kwargs)
362
+            self.fields['router_ids'].choices = router_choices
363
+        except Exception as e:
364
+            LOG.error('Failed to retrieve current routers in firewall %(id)s: '
365
+                      '%(reason)s',
366
+                      {'id': self.initial['firewall_id'], 'reason': e})
367
+            msg = (_('Failed to retrieve current routers in firewall '
368
+                     '%(name)s: %(reason)s') %
369
+                   {'name': self.initial['name'], 'reason': e})
370
+            redirect = reverse(self.failure_url)
371
+            exceptions.handle(request, msg, redirect=redirect)
373 372
 
374 373
     def get_router_choices(self, request, kwargs):
375 374
         tenant_id = self.request.user.tenant_id
@@ -381,3 +380,23 @@ class RemoveRouterFromFirewall(RouterInsertionFormBase):
381 380
     def get_new_router_ids(self, context):
382 381
         # context[router_ids] is router IDs to be kept.
383 382
         return context['router_ids']
383
+
384
+    def handle(self, request, context):
385
+        firewall_id = self.initial['firewall_id']
386
+        firewall_name_or_id = self.initial['name'] or firewall_id
387
+        try:
388
+            body = {'router_ids': self.get_new_router_ids(context)}
389
+            firewall = api.fwaas.firewall_update(request, firewall_id, **body)
390
+            msg = (_('Router(s)  was successfully removed from firewall '
391
+                     '%(firewall)s.') %
392
+                   {'firewall': firewall_name_or_id})
393
+            messages.success(request, msg)
394
+            return firewall
395
+        except Exception as e:
396
+            LOG.error('Failed to remove router(s) from firewall %(id)s: '
397
+                      '%(reason)s', {'id': firewall_id, 'reason': e})
398
+            msg = (_('Failed to remove router(s) from firewall %(name)s: '
399
+                     '%(reason)s') %
400
+                   {'name': firewall_name_or_id, 'reason': e})
401
+            redirect = reverse(self.failure_url)
402
+            exceptions.handle(request, msg, redirect=redirect)

+ 2
- 3
openstack_dashboard/dashboards/project/firewalls/tables.py View File

@@ -418,7 +418,6 @@ class FirewallsTable(tables.DataTable):
418 418
                                                       'fwaasrouterinsertion'):
419 419
                 del self.columns['router_ids']
420 420
         except Exception as e:
421
-            msg = _('Failed to verify extension support %(reason)s') % {
422
-                'reason': e}
423
-            LOG.error(msg)
421
+            LOG.error('Failed to verify extension support %s', e)
422
+            msg = _('Failed to verify extension support %s') % e
424 423
             exceptions.handle(request, msg)

+ 3
- 3
openstack_dashboard/dashboards/project/networks/forms.py View File

@@ -62,11 +62,11 @@ class UpdateNetwork(forms.SelfHandlingForm):
62 62
                                                  data['network_id'],
63 63
                                                  **params)
64 64
             msg = _('Network %s was successfully updated.') % data['name']
65
-            LOG.debug(msg)
66 65
             messages.success(request, msg)
67 66
             return network
68
-        except Exception:
67
+        except Exception as e:
68
+            LOG.info('Failed to update network %(id)s: %(exc)s',
69
+                     {'id': data['network_id'], 'exc': e})
69 70
             msg = _('Failed to update network %s') % data['name']
70
-            LOG.info(msg)
71 71
             redirect = reverse(self.failure_url)
72 72
             exceptions.handle(request, msg, redirect=redirect)

+ 8
- 8
openstack_dashboard/dashboards/project/networks/ports/forms.py View File

@@ -159,13 +159,13 @@ class CreatePort(forms.SelfHandlingForm):
159 159
                 msg = _('Port %s was successfully created.') % port['name']
160 160
             else:
161 161
                 msg = _('Port %s was successfully created.') % port['id']
162
-            LOG.debug(msg)
163 162
             messages.success(request, msg)
164 163
             return port
165
-        except Exception:
166
-            msg = _('Failed to create a port for network %s') \
167
-                % data['network_id']
168
-            LOG.info(msg)
164
+        except Exception as e:
165
+            LOG.info('Failed to create a port for network %(id)s: %(exc)s',
166
+                     {'id': data['network_id'], 'exc': e})
167
+            msg = (_('Failed to create a port for network %s')
168
+                   % data['network_id'])
169 169
             redirect = reverse(self.failure_url,
170 170
                                args=(data['network_id'],))
171 171
             exceptions.handle(request, msg, redirect=redirect)
@@ -248,12 +248,12 @@ class UpdatePort(forms.SelfHandlingForm):
248 248
                                            admin_state_up=data['admin_state'],
249 249
                                            **extension_kwargs)
250 250
             msg = _('Port %s was successfully updated.') % data['port_id']
251
-            LOG.debug(msg)
252 251
             messages.success(request, msg)
253 252
             return port
254
-        except Exception:
253
+        except Exception as e:
254
+            LOG.info('Failed to update port %(id)s: %(exc)s',
255
+                     {'id': data['port_id'], 'exc': e})
255 256
             msg = _('Failed to update port %s') % data['port_id']
256
-            LOG.info(msg)
257 257
             redirect = reverse(self.failure_url,
258 258
                                args=[data['network_id']])
259 259
             exceptions.handle(request, msg, redirect=redirect)

+ 4
- 3
openstack_dashboard/dashboards/project/networks/ports/tables.py View File

@@ -106,9 +106,10 @@ class DeletePort(policy.PolicyTargetMixin, tables.DeleteAction):
106 106
         failure_url = "horizon:project:networks:detail"
107 107
         try:
108 108
             api.neutron.port_delete(request, port_id)
109
-        except Exception:
110
-            msg = _('Failed to delete port: %s') % port_id
111
-            LOG.info(msg)
109
+        except Exception as e:
110
+            LOG.info('Failed to delete port %(id)s: %(exc)s',
111
+                     {'id': port_id, 'exc': e})
112
+            msg = _('Failed to delete port %s') % port_id
112 113
             network_id = self.table.kwargs['network_id']
113 114
             redirect = reverse(failure_url,
114 115
                                args=[network_id])

+ 3
- 2
openstack_dashboard/dashboards/project/networks/subnets/tables.py View File

@@ -79,9 +79,10 @@ class DeleteSubnet(SubnetPolicyTargetMixin, CheckNetworkEditable,
79 79
     def delete(self, request, obj_id):
80 80
         try:
81 81
             api.neutron.subnet_delete(request, obj_id)
82
-        except Exception:
82
+        except Exception as e:
83
+            LOG.info('Failed to delete subnet %(id)s: %(exc)s',
84
+                     {'id': obj_id, 'exc': e})
83 85
             msg = _('Failed to delete subnet %s') % obj_id
84
-            LOG.info(msg)
85 86
             network_id = self.table.kwargs['network_id']
86 87
             redirect = reverse('horizon:project:networks:detail',
87 88
                                args=[network_id])

+ 3
- 2
openstack_dashboard/dashboards/project/networks/tables.py View File

@@ -75,9 +75,10 @@ class DeleteNetwork(policy.PolicyTargetMixin, CheckNetworkEditable,
75 75
                 LOG.debug('Deleted subnet %s', subnet_id)
76 76
             api.neutron.network_delete(request, network_id)
77 77
             LOG.debug('Deleted network %s successfully', network_id)
78
-        except Exception:
78
+        except Exception as e:
79
+            LOG.info('Failed to delete network %(id)s: %(exc)s',
80
+                     {'id': network_id, 'exc': e})
79 81
             msg = _('Failed to delete network %s')
80
-            LOG.info(msg, network_id)
81 82
             redirect = reverse("horizon:project:networks:index")
82 83
             exceptions.handle(request, msg % network_name, redirect=redirect)
83 84
 

+ 6
- 4
openstack_dashboard/dashboards/project/networks/workflows.py View File

@@ -469,9 +469,9 @@ class CreateNetwork(workflows.Workflow):
469 469
                       network.name_or_id)
470 470
             return network
471 471
         except Exception as e:
472
+            LOG.info('Failed to create network: %s', e)
472 473
             msg = (_('Failed to create network "%(network)s": %(reason)s') %
473 474
                    {"network": data['net_name'], "reason": e})
474
-            LOG.info(msg)
475 475
             redirect = self.get_failure_url()
476 476
             exceptions.handle(request, msg, redirect=redirect)
477 477
             return False
@@ -560,15 +560,17 @@ class CreateNetwork(workflows.Workflow):
560 560
         """Delete the created network when subnet creation failed."""
561 561
         try:
562 562
             api.neutron.network_delete(request, network.id)
563
+            LOG.debug('Delete the created network %s '
564
+                      'due to subnet creation failure.', network.id)
563 565
             msg = _('Delete the created network "%s" '
564 566
                     'due to subnet creation failure.') % network.name
565
-            LOG.debug(msg)
566 567
             redirect = self.get_failure_url()
567 568
             messages.info(request, msg)
568 569
             raise exceptions.Http302(redirect)
569
-        except Exception:
570
+        except Exception as e:
571
+            LOG.info('Failed to delete network %(id)s: %(exc)s',
572
+                     {'id': network.id, 'exc': e})
570 573
             msg = _('Failed to delete network "%s"') % network.name
571
-            LOG.info(msg)
572 574
             redirect = self.get_failure_url()
573 575
             exceptions.handle(request, msg, redirect=redirect)
574 576
 

+ 5
- 5
openstack_dashboard/dashboards/project/routers/extensions/extraroutes/forms.py View File

@@ -43,18 +43,18 @@ class AddRouterRoute(forms.SelfHandlingForm):
43 43
                                         router_id,
44 44
                                         route)
45 45
             msg = _('Static route added')
46
-            LOG.debug(msg)
47 46
             messages.success(request, msg)
48 47
             return True
49 48
         except neutron_exc.BadRequest as e:
50
-            msg = (_('Invalid format for routes : %s') % e)
51
-            LOG.info(msg)
49
+            LOG.info('Invalid format for routes %(route)s: %(exc)s',
50
+                     {'route': route, 'exc': e})
51
+            msg = _('Invalid format for routes: %s') % e
52 52
             messages.error(request, msg)
53 53
             redirect = reverse(self.failure_url, args=[router_id])
54 54
             exceptions.handle(request, msg, redirect=redirect)
55 55
         except Exception as e:
56
-            msg = (_('Failed to add route : %s') % e)
57
-            LOG.info(msg)
56
+            LOG.info('Failed to add route: %s', e)
57
+            msg = _('Failed to add route: %s') % e
58 58
             messages.error(request, msg)
59 59
             redirect = reverse(self.failure_url, args=[router_id])
60 60
             exceptions.handle(request, msg, redirect=redirect)

+ 3
- 3
openstack_dashboard/dashboards/project/routers/extensions/extraroutes/tabs.py View File

@@ -36,9 +36,9 @@ class ExtraRoutesTab(tabs.TableTab):
36 36
     def allowed(self, request):
37 37
         try:
38 38
             return api.is_extension_supported(request, 'extraroute')
39
-        except Exception:
40
-            LOG.info(_("Failed to check if Neutron extraroute extension is "
41
-                       "supported"))
39
+        except Exception as e:
40
+            LOG.info("Failed to check if Neutron extraroute extension is "
41
+                     "supported: %s", e)
42 42
             return False
43 43
 
44 44
     def get_extra_routes_data(self):

+ 6
- 6
openstack_dashboard/dashboards/project/routers/forms.py View File

@@ -74,9 +74,9 @@ class CreateForm(forms.SelfHandlingForm):
74 74
         search_opts = {'router:external': True}
75 75
         try:
76 76
             networks = api.neutron.network_list(request, **search_opts)
77
-        except Exception:
77
+        except Exception as e:
78
+            LOG.info('Failed to get network list: %s', e)
78 79
             msg = _('Failed to get network list.')
79
-            LOG.info(msg)
80 80
             messages.warning(request, msg)
81 81
             networks = []
82 82
 
@@ -103,11 +103,11 @@ class CreateForm(forms.SelfHandlingForm):
103 103
             messages.success(request, message)
104 104
             return router
105 105
         except Exception as exc:
106
+            LOG.info('Failed to create router: %s', exc)
106 107
             if exc.status_code == 409:
107 108
                 msg = _('Quota exceeded for resource router.')
108 109
             else:
109 110
                 msg = _('Failed to create router "%s".') % data['name']
110
-            LOG.info(msg)
111 111
             redirect = reverse(self.failure_url)
112 112
             exceptions.handle(request, msg, redirect=redirect)
113 113
             return False
@@ -162,10 +162,10 @@ class UpdateForm(forms.SelfHandlingForm):
162 162
             router = api.neutron.router_update(request, data['router_id'],
163 163
                                                **params)
164 164
             msg = _('Router %s was successfully updated.') % data['name']
165
-            LOG.debug(msg)
166 165
             messages.success(request, msg)
167 166
             return router
168
-        except Exception:
167
+        except Exception as exc:
168
+            LOG.info('Failed to update router %(id)s: %(exc)s',
169
+                     {'id': data['router_id'], 'exc': exc})
169 170
             msg = _('Failed to update router %s') % data['name']
170
-            LOG.info(msg)
171 171
             exceptions.handle(request, msg, redirect=self.redirect_url)

+ 12
- 12
openstack_dashboard/dashboards/project/routers/ports/forms.py View File

@@ -59,8 +59,8 @@ class AddInterface(forms.SelfHandlingForm):
59 59
                 router_subnet_ids = [fixed_ip["subnet_id"] for port in ports
60 60
                                      for fixed_ip in port.fixed_ips]
61 61
         except Exception as e:
62
-            msg = _('Failed to get network list %s') % e
63
-            LOG.info(msg)
62
+            LOG.info('Failed to get network list: %s', e)
63
+            msg = _('Failed to get network list: %s') % e
64 64
             messages.error(request, msg)
65 65
             if router_id:
66 66
                 redirect = reverse(self.failure_url, args=[router_id])
@@ -92,7 +92,6 @@ class AddInterface(forms.SelfHandlingForm):
92 92
         msg = _('Interface added')
93 93
         if port:
94 94
             msg += ' ' + port.fixed_ips[0]['ip_address']
95
-        LOG.debug(msg)
96 95
         messages.success(request, msg)
97 96
         return True
98 97
 
@@ -136,17 +135,18 @@ class AddInterface(forms.SelfHandlingForm):
136 135
         return port
137 136
 
138 137
     def _handle_error(self, request, router_id, reason):
139
-        msg = _('Failed to add_interface: %s') % reason
140
-        LOG.info(msg)
138
+        LOG.info('Failed to add_interface: %s', reason)
139
+        msg = _('Failed to add interface: %s') % reason
141 140
         redirect = reverse(self.failure_url, args=[router_id])
142 141
         exceptions.handle(request, msg, redirect=redirect)
143 142
 
144 143
     def _delete_port(self, request, port):
145 144
         try:
146 145
             api.neutron.port_delete(request, port.id)
147
-        except Exception:
146
+        except Exception as e:
147
+            LOG.info('Failed to delete port %(id)s: %(exc)s',
148
+                     {'id': port.id, 'exc': e})
148 149
             msg = _('Failed to delete port %s') % port.id
149
-            LOG.info(msg)
150 150
             exceptions.handle(request, msg)
151 151
 
152 152
 
@@ -170,8 +170,8 @@ class SetGatewayForm(forms.SelfHandlingForm):
170 170
         try:
171 171
             networks = api.neutron.network_list(request, **search_opts)
172 172
         except Exception as e:
173
-            msg = _('Failed to get network list %s') % e
174
-            LOG.info(msg)
173
+            LOG.info('Faield to get network list: %s', e)
174
+            msg = _('Failed to get network list: %s') % e
175 175
             messages.error(request, msg)
176 176
             redirect = reverse(self.failure_url)
177 177
             exceptions.handle(request, msg, redirect=redirect)
@@ -190,11 +190,11 @@ class SetGatewayForm(forms.SelfHandlingForm):
190 190
                                            data['router_id'],
191 191
                                            data['network_id'])
192 192
             msg = _('Gateway interface is added')
193
-            LOG.debug(msg)
194 193
             messages.success(request, msg)
195 194
             return True
196 195
         except Exception as e:
197
-            msg = _('Failed to set gateway %s') % e
198
-            LOG.info(msg)
196
+            LOG.info('Failed to set gateway to router %(id)s: %(exc)s',
197
+                     {'id': data['router_id'], 'exc': e})
198
+            msg = _('Failed to set gateway: %s') % e
199 199
             redirect = reverse(self.failure_url)
200 200
             exceptions.handle(request, msg, redirect=redirect)

+ 3
- 2
openstack_dashboard/dashboards/project/routers/ports/tables.py View File

@@ -81,9 +81,10 @@ class RemoveInterface(policy.PolicyTargetMixin, tables.DeleteAction):
81 81
                 api.neutron.router_remove_interface(request,
82 82
                                                     router_id,
83 83
                                                     port_id=obj_id)
84
-        except Exception:
84
+        except Exception as e:
85
+            LOG.info('Failed to delete interface %(id)s: %(exc)s',
86
+                     {'id': obj_id, 'exc': e})
85 87
             msg = _('Failed to delete interface %s') % obj_id
86
-            LOG.info(msg)
87 88
             router_id = self.table.kwargs['router_id']
88 89
             redirect = reverse(self.failure_url,
89 90
                                args=[router_id])

+ 13
- 5
openstack_dashboard/dashboards/project/routers/tables.py View File

@@ -64,16 +64,23 @@ class DeleteRouter(policy.PolicyTargetMixin, tables.DeleteAction):
64 64
                                                     port_id=port.id)
65 65
             api.neutron.router_delete(request, obj_id)
66 66
         except q_ext.NeutronClientException as e:
67
-            msg = _('Unable to delete router "%s"') % e
68
-            LOG.info(msg)
67
+            # TODO(amotoki): Revisit why Http302 needs to be raised.
68
+            # We have this pattern ONLY HERE.
69
+            # Can't we merge two except clauses?
70
+            LOG.info('Unable to delete router %(id)s: %(exc)s',
71
+                     {'id': obj_id, 'exc': e})
72
+            obj = self.table.get_object_by_id(obj_id)
73
+            name = self.table.get_object_display(obj)
74
+            msg = _('Unable to delete router "%s"') % name
69 75
             messages.error(request, msg)
70 76
             redirect = reverse(self.redirect_url)
71 77
             raise exceptions.Http302(redirect, message=msg)
72
-        except Exception:
78
+        except Exception as e:
79
+            LOG.info('Unable to delete router %(id)s: %(exc)s',
80
+                     {'id': obj_id, 'exc': e})
73 81
             obj = self.table.get_object_by_id(obj_id)
74 82
             name = self.table.get_object_display(obj)
75 83
             msg = _('Unable to delete router "%s"') % name
76
-            LOG.info(msg)
77 84
             exceptions.handle(request, msg)
78 85
 
79 86
     def allowed(self, request, router=None):
@@ -158,10 +165,11 @@ class ClearGateway(policy.PolicyTargetMixin, tables.BatchAction):
158 165
         try:
159 166
             api.neutron.router_remove_gateway(request, obj_id)
160 167
         except Exception as e:
168
+            LOG.info('Unable to clear gateway for router %(id)s: %(exc)s',
169
+                     {'id': obj_id, 'exc': e})
161 170
             msg = (_('Unable to clear gateway for router '
162 171
                      '"%(name)s": "%(msg)s"')
163 172
                    % {"name": name, "msg": e})
164
-            LOG.info(msg)
165 173
             redirect = reverse(self.redirect_url)
166 174
             exceptions.handle(request, msg, redirect=redirect)
167 175
 

+ 8
- 8
openstack_dashboard/dashboards/project/vpn/forms.py View File

@@ -49,12 +49,12 @@ class UpdateVPNService(forms.SelfHandlingForm):
49 49
                 request, context['vpnservice_id'], **data)
50 50
             msg = (_('VPN Service %s was successfully updated.')
51 51
                    % context['name'])
52
-            LOG.debug(msg)
53 52
             messages.success(request, msg)
54 53
             return vpnservice
55 54
         except Exception as e:
55
+            LOG.info('Failed to update VPN Service %(id)s: %(exc)s',
56
+                     {'id': context['vpnservice_id'], 'exc': e})
56 57
             msg = _('Failed to update VPN Service %s') % context['name']
57
-            LOG.info('%(msg)s: %(exception)s', {'msg': msg, 'exception': e})
58 58
             redirect = reverse(self.failure_url)
59 59
             exceptions.handle(request, msg, redirect=redirect)
60 60
 
@@ -128,12 +128,12 @@ class UpdateIKEPolicy(forms.SelfHandlingForm):
128 128
                 request, context['ikepolicy_id'], **data)
129 129
             msg = (_('IKE Policy %s was successfully updated.')
130 130
                    % context['name'])
131
-            LOG.debug(msg)
132 131
             messages.success(request, msg)
133 132
             return ikepolicy
134 133
         except Exception as e:
134
+            LOG.info('Failed to update IKE Policy %(id)s: %(exc)s',
135
+                     {'id': context['ikepolicy_id'], 'exc': e})
135 136
             msg = _('Failed to update IKE Policy %s') % context['name']
136
-            LOG.info('%(msg)s: %(exception)s', {'msg': msg, 'exception': e})
137 137
             redirect = reverse(self.failure_url)
138 138
             exceptions.handle(request, msg, redirect=redirect)
139 139
 
@@ -206,12 +206,12 @@ class UpdateIPSecPolicy(forms.SelfHandlingForm):
206 206
                 request, context['ipsecpolicy_id'], **data)
207 207
             msg = (_('IPSec Policy %s was successfully updated.')
208 208
                    % context['name'])
209
-            LOG.debug(msg)
210 209
             messages.success(request, msg)
211 210
             return ipsecpolicy
212 211
         except Exception as e:
212
+            LOG.info('Failed to update IPSec Policy %(id)s: %(exc)s',
213
+                     {'id': context['ipsecpolicy_id'], 'exc': e})
213 214
             msg = _('Failed to update IPSec Policy %s') % context['name']
214
-            LOG.info('%(msg)s: %(exception)s', {'msg': msg, 'exception': e})
215 215
             redirect = reverse(self.failure_url)
216 216
             exceptions.handle(request, msg, redirect=redirect)
217 217
 
@@ -312,12 +312,12 @@ class UpdateIPSecSiteConnection(forms.SelfHandlingForm):
312 312
                 request, context['ipsecsiteconnection_id'], **data)
313 313
             msg = (_('IPSec Site Connection %s was successfully updated.')
314 314
                    % context['name'])
315
-            LOG.debug(msg)
316 315
             messages.success(request, msg)
317 316
             return ipsecsiteconnection
318 317
         except Exception as e:
318
+            LOG.info('Failed to update IPSec Site Connection %(id)s: %(exc)s',
319
+                     {'id': context['ipsecsiteconnection_id'], 'exc': e})
319 320
             msg = (_('Failed to update IPSec Site Connection %s')
320 321
                    % context['name'])
321
-            LOG.info('%(msg)s: %(exception)s', {'msg': msg, 'exception': e})
322 322
             redirect = reverse(self.failure_url)
323 323
             exceptions.handle(request, msg, redirect=redirect)

Loading…
Cancel
Save