Browse Source

Ensure log messages are not translated

Previously translated messages are included in log messages
and it was determined what language is chosen by users.
It makes difficult for operators to understand log messgaes.

This commit tries to use English messages for all log messages.
The following policies are applied based on the past discussions
in the bug 1406333 and related reviews.

- English messages are used for log messages.
- log messages include exception messages if possible
  to help operators identify what happens.
- Use ID rather than name for log messages
  as ID is much more unique compared to name.
- LOG.debug() in success code path are deleted.
  We don't log success messages in most places and API calls to
  back-end services can be logged from python bindings.

Change-Id: Ie554463908327435d886d0d0f1671fd327c0cd00
Closes-Bug: #1406333
Akihiro Motoki 2 years ago
parent
commit
ced987815d
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

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

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

@@ -124,15 +124,15 @@ class CreatePort(project_forms.CreatePort):
124 124
 
125 125
             port = api.neutron.port_create(request, **params)
126 126
             msg = _('Port %s was successfully created.') % port['id']
127
-            LOG.debug(msg)
128 127
             messages.success(request, msg)
129 128
             return port
130
-        except Exception:
131
-            msg = _('Failed to create a port for network %s') \
132
-                % data['network_id']
133
-            LOG.info(msg)
129
+        except Exception as e:
130
+            net_id = data['network_id']
131
+            LOG.info('Failed to create a port for network %(id)s: %(exc)s',
132
+                     {'id': net_id, 'exc': e})
133
+            msg = _('Failed to create a port for network %s') % net_id
134 134
             redirect = reverse(self.failure_url,
135
-                               args=(data['network_id'],))
135
+                               args=(net_id,))
136 136
             exceptions.handle(request, msg, redirect=redirect)
137 137
 
138 138
 
@@ -185,12 +185,12 @@ class UpdatePort(project_forms.UpdatePort):
185 185
                                            mac_address=data['mac_address'],
186 186
                                            **extension_kwargs)
187 187
             msg = _('Port %s was successfully updated.') % data['port_id']
188
-            LOG.debug(msg)
189 188
             messages.success(request, msg)
190 189
             return port
191
-        except Exception:
190
+        except Exception as e:
191
+            LOG.info('Failed to update port %(id)s: %(exc)s',
192
+                     {'id': data['port_id'], 'exc': e})
192 193
             msg = _('Failed to update port %s') % data['port_id']
193
-            LOG.info(msg)
194 194
             redirect = reverse(self.failure_url,
195 195
                                args=[data['network_id']])
196 196
             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
 
@@ -170,13 +169,13 @@ class UpdateFirewall(forms.SelfHandlingForm):
170 169
             firewall = api.fwaas.firewall_update(request, firewall_id,
171 170
                                                  **context)
172 171
             msg = _('Firewall %s was successfully updated.') % name_or_id
173
-            LOG.debug(msg)
174 172
             messages.success(request, msg)
175 173
             return firewall
176 174
         except Exception as e:
177
-            msg = _('Failed to update firewall %(name)s: %(reason)s') % {
178
-                'name': name_or_id, 'reason': e}
179
-            LOG.error(msg)
175
+            LOG.error('Failed to update firewall %(id)s: %(reason)s',
176
+                      {'id': firewall_id, 'reason': e})
177
+            msg = (_('Failed to update firewall %(name)s: %(reason)s') %
178
+                   {'name': name_or_id, 'reason': e})
180 179
             redirect = reverse(self.failure_url)
181 180
             exceptions.handle(request, msg, redirect=redirect)
182 181
 
@@ -210,8 +209,8 @@ class InsertRuleToPolicy(forms.SelfHandlingForm):
210 209
             current_choices = [(r.id, r.name_or_id) for r in current_rules]
211 210
 
212 211
         except Exception as e:
212
+            LOG.error('Failed to retrieve available rules: %s', e)
213 213
             msg = _('Failed to retrieve available rules: %s') % e
214
-            LOG.error(msg)
215 214
             redirect = reverse(self.failure_url)
216 215
             exceptions.handle(request, msg, redirect=redirect)
217 216
 
@@ -233,13 +232,13 @@ class InsertRuleToPolicy(forms.SelfHandlingForm):
233 232
                     '%(policy)s.') % {
234 233
                         'rule': insert_rule.name or insert_rule.id,
235 234
                         'policy': policy_name_or_id}
236
-            LOG.debug(msg)
237 235
             messages.success(request, msg)
238 236
             return policy
239 237
         except Exception as e:
240
-            msg = _('Failed to insert rule to policy %(name)s: %(reason)s') % {
241
-                'name': policy_id, 'reason': e}
242
-            LOG.error(msg)
238
+            LOG.error('Failed to insert rule to policy %(id)s: %(reason)s',
239
+                      {'id': policy_id, 'reason': e})
240
+            msg = (_('Failed to insert rule to policy %(name)s: %(reason)s') %
241
+                   {'name': policy_id, 'reason': e})
243 242
             redirect = reverse(self.failure_url)
244 243
             exceptions.handle(request, msg, redirect=redirect)
245 244
 
@@ -263,9 +262,12 @@ class RemoveRuleFromPolicy(forms.SelfHandlingForm):
263 262
 
264 263
             current_choices = [(r.id, r.name_or_id) for r in current_rules]
265 264
         except Exception as e:
266
-            msg = _('Failed to retrieve current rules in policy %(name)s: '
267
-                    '%(reason)s') % {'name': self.initial['name'], 'reason': e}
268
-            LOG.error(msg)
265
+            LOG.error('Failed to retrieve current rules in policy %(id)s: '
266
+                      '%(reason)s',
267
+                      {'id': self.initial['policy_id'], 'reason': e})
268
+            msg = (_('Failed to retrieve current rules in policy %(name)s: '
269
+                     '%(reason)s') %
270
+                   {'name': self.initial['name'], 'reason': e})
269 271
             redirect = reverse(self.failure_url)
270 272
             exceptions.handle(request, msg, redirect=redirect)
271 273
 
@@ -283,39 +285,47 @@ class RemoveRuleFromPolicy(forms.SelfHandlingForm):
283 285
                     '%(policy)s.') % {
284 286
                         'rule': remove_rule.name or remove_rule.id,
285 287
                         'policy': policy_name_or_id}
286
-            LOG.debug(msg)
287 288
             messages.success(request, msg)
288 289
             return policy
289 290
         except Exception as e:
290
-            msg = _('Failed to remove rule from policy %(name)s: '
291
-                    '%(reason)s') % {'name': self.initial['name'],
292
-                                     'reason': e}
293
-            LOG.error(msg)
291
+            LOG.error('Failed to remove rule from policy %(id)s: %(reason)s',
292
+                      {'id': policy_id, 'reason': e})
293
+            msg = (_('Failed to remove rule from policy %(name)s: %(reason)s')
294
+                   % {'name': self.initial['name'], 'reason': e})
294 295
             redirect = reverse(self.failure_url)
295 296
             exceptions.handle(request, msg, redirect=redirect)
296 297
 
297 298
 
298
-class RouterInsertionFormBase(forms.SelfHandlingForm):
299
+class AddRouterToFirewall(forms.SelfHandlingForm):
300
+    router_ids = forms.MultipleChoiceField(
301
+        label=_("Add Routers"),
302
+        required=False,
303
+        widget=forms.ThemableCheckboxSelectMultiple(),
304
+        help_text=_("Add selected router(s) to the firewall."))
305
+
306
+    failure_url = 'horizon:project:firewalls:index'
299 307
 
300 308
     def __init__(self, request, *args, **kwargs):
301
-        super(RouterInsertionFormBase, self).__init__(request, *args, **kwargs)
309
+        super(AddRouterToFirewall, self).__init__(request, *args, **kwargs)
302 310
         try:
303 311
             router_choices = self.get_router_choices(request, kwargs)
304 312
             self.fields['router_ids'].choices = router_choices
305 313
         except Exception as e:
306
-            msg = self.init_failure_msg % {'name': self.initial['name'],
307
-                                           'reason': e}
308
-            LOG.error(msg)
314
+            LOG.error('Failed to retrieve available routers: %s', e)
315
+            msg = _('Failed to retrieve available routers: %s') % e
309 316
             redirect = reverse(self.failure_url)
310 317
             exceptions.handle(request, msg, redirect=redirect)
311 318
 
312
-    @abc.abstractmethod
313 319
     def get_router_choices(self, request, kwargs):
314
-        """Return a list of selectable routers."""
320
+        tenant_id = self.request.user.tenant_id
321
+        routers_list = api.fwaas.firewall_unassociated_routers_list(
322
+            request, tenant_id)
323
+        return [(r.id, r.name_or_id) for r in routers_list]
315 324
 
316
-    @abc.abstractmethod
317 325
     def get_new_router_ids(self, context):
318
-        """Return a new list of router IDs associated with the firewall."""
326
+        existing_router_ids = self.initial['router_ids']
327
+        add_router_ids = context['router_ids']
328
+        return add_router_ids + existing_router_ids
319 329
 
320 330
     def handle(self, request, context):
321 331
         firewall_id = self.initial['firewall_id']
@@ -323,43 +333,22 @@ class RouterInsertionFormBase(forms.SelfHandlingForm):
323 333
         try:
324 334
             body = {'router_ids': self.get_new_router_ids(context)}
325 335
             firewall = api.fwaas.firewall_update(request, firewall_id, **body)
326
-            msg = self.success_msg % {'firewall': firewall_name_or_id}
327
-            LOG.debug(msg)
336
+            msg = (_('Router(s) was/were successfully added to firewall '
337
+                     '%(firewall)s.') %
338
+                   {'firewall': firewall_name_or_id})
328 339
             messages.success(request, msg)
329 340
             return firewall
330 341
         except Exception as e:
331
-            msg = self.failure_msg % {'name': firewall_name_or_id, 'reason': e}
332
-            LOG.error(msg)
342
+            LOG.error('Failed to add router(s) to firewall %(id)s: %(reason)s',
343
+                      {'id': firewall_id, 'reason': e})
344
+            msg = (_('Failed to add router(s) to firewall %(name)s: '
345
+                     '%(reason)s') %
346
+                   {'name': firewall_name_or_id, 'reason': e})
333 347
             redirect = reverse(self.failure_url)
334 348
             exceptions.handle(request, msg, redirect=redirect)
335 349
 
336 350
 
337
-class AddRouterToFirewall(RouterInsertionFormBase):
338
-    router_ids = forms.MultipleChoiceField(
339
-        label=_("Add Routers"),
340
-        required=False,
341
-        widget=forms.ThemableCheckboxSelectMultiple(),
342
-        help_text=_("Add selected router(s) to the firewall."))
343
-
344
-    failure_url = 'horizon:project:firewalls:index'
345
-    success_msg = _('Router(s) was/were successfully added to firewall '
346
-                    '%(firewall)s.')
347
-    failure_msg = _('Failed to add router(s) to firewall %(name)s: %(reason)s')
348
-    init_failure_msg = _('Failed to retrieve available routers: %(reason)s')
349
-
350
-    def get_router_choices(self, request, kwargs):
351
-        tenant_id = self.request.user.tenant_id
352
-        routers_list = api.fwaas.firewall_unassociated_routers_list(
353
-            request, tenant_id)
354
-        return [(r.id, r.name_or_id) for r in routers_list]
355
-
356
-    def get_new_router_ids(self, context):
357
-        existing_router_ids = self.initial['router_ids']
358
-        add_router_ids = context['router_ids']
359
-        return add_router_ids + existing_router_ids
360
-
361
-
362
-class RemoveRouterFromFirewall(RouterInsertionFormBase):
351
+class RemoveRouterFromFirewall(forms.SelfHandlingForm):
363 352
     router_ids = forms.MultipleChoiceField(
364 353
         label=_("Associated Routers"),
365 354
         required=False,
@@ -367,12 +356,22 @@ class RemoveRouterFromFirewall(RouterInsertionFormBase):
367 356
         help_text=_("Unselect the router(s) to be removed from firewall."))
368 357
 
369 358
     failure_url = 'horizon:project:firewalls:index'
370
-    success_msg = _('Router(s)  was successfully removed from firewall '
371
-                    '%(firewall)s.')
372
-    failure_msg = _('Failed to remove router(s) from firewall %(name)s: '
373
-                    '%(reason)s')
374
-    init_failure_msg = _('Failed to retrieve current routers in firewall '
375
-                         '%(name)s: %(reason)s')
359
+
360
+    def __init__(self, request, *args, **kwargs):
361
+        super(RemoveRouterFromFirewall, self).__init__(request,
362
+                                                       *args, **kwargs)
363
+        try:
364
+            router_choices = self.get_router_choices(request, kwargs)
365
+            self.fields['router_ids'].choices = router_choices
366
+        except Exception as e:
367
+            LOG.error('Failed to retrieve current routers in firewall %(id)s: '
368
+                      '%(reason)s',
369
+                      {'id': self.initial['firewall_id'], 'reason': e})
370
+            msg = (_('Failed to retrieve current routers in firewall '
371
+                     '%(name)s: %(reason)s') %
372
+                   {'name': self.initial['name'], 'reason': e})
373
+            redirect = reverse(self.failure_url)
374
+            exceptions.handle(request, msg, redirect=redirect)
376 375
 
377 376
     def get_router_choices(self, request, kwargs):
378 377
         tenant_id = self.request.user.tenant_id
@@ -384,3 +383,23 @@ class RemoveRouterFromFirewall(RouterInsertionFormBase):
384 383
     def get_new_router_ids(self, context):
385 384
         # context[router_ids] is router IDs to be kept.
386 385
         return context['router_ids']
386
+
387
+    def handle(self, request, context):
388
+        firewall_id = self.initial['firewall_id']
389
+        firewall_name_or_id = self.initial['name'] or firewall_id
390
+        try:
391
+            body = {'router_ids': self.get_new_router_ids(context)}
392
+            firewall = api.fwaas.firewall_update(request, firewall_id, **body)
393
+            msg = (_('Router(s)  was successfully removed from firewall '
394
+                     '%(firewall)s.') %
395
+                   {'firewall': firewall_name_or_id})
396
+            messages.success(request, msg)
397
+            return firewall
398
+        except Exception as e:
399
+            LOG.error('Failed to remove router(s) from firewall %(id)s: '
400
+                      '%(reason)s', {'id': firewall_id, 'reason': e})
401
+            msg = (_('Failed to remove router(s) from firewall %(name)s: '
402
+                     '%(reason)s') %
403
+                   {'name': firewall_name_or_id, 'reason': e})
404
+            redirect = reverse(self.failure_url)
405
+            exceptions.handle(request, msg, redirect=redirect)

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

@@ -409,7 +409,6 @@ class FirewallsTable(tables.DataTable):
409 409
                                                       'fwaasrouterinsertion'):
410 410
                 del self.columns['router_ids']
411 411
         except Exception as e:
412
-            msg = _('Failed to verify extension support %(reason)s') % {
413
-                'reason': e}
414
-            LOG.error(msg)
412
+            LOG.error('Failed to verify extension support %s', e)
413
+            msg = _('Failed to verify extension support %s') % e
415 414
             exceptions.handle(request, msg)

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

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

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

@@ -156,13 +156,13 @@ class CreatePort(forms.SelfHandlingForm):
156 156
                 msg = _('Port %s was successfully created.') % port['name']
157 157
             else:
158 158
                 msg = _('Port %s was successfully created.') % port['id']
159
-            LOG.debug(msg)
160 159
             messages.success(request, msg)
161 160
             return port
162
-        except Exception:
163
-            msg = _('Failed to create a port for network %s') \
164
-                % data['network_id']
165
-            LOG.info(msg)
161
+        except Exception as e:
162
+            LOG.info('Failed to create a port for network %(id)s: %(exc)s',
163
+                     {'id': data['network_id'], 'exc': e})
164
+            msg = (_('Failed to create a port for network %s')
165
+                   % data['network_id'])
166 166
             redirect = reverse(self.failure_url,
167 167
                                args=(data['network_id'],))
168 168
             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

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

+ 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

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

@@ -52,12 +52,12 @@ class UpdateVPNService(forms.SelfHandlingForm):
52 52
                 request, context['vpnservice_id'], **data)
53 53
             msg = (_('VPN Service %s was successfully updated.')
54 54
                    % context['name'])
55
-            LOG.debug(msg)
56 55
             messages.success(request, msg)
57 56
             return vpnservice
58 57
         except Exception as e:
58
+            LOG.info('Failed to update VPN Service %(id)s: %(exc)s',
59
+                     {'id': context['vpnservice_id'], 'exc': e})
59 60
             msg = _('Failed to update VPN Service %s') % context['name']
60
-            LOG.info('%(msg)s: %(exception)s', {'msg': msg, 'exception': e})
61 61
             redirect = reverse(self.failure_url)
62 62
             exceptions.handle(request, msg, redirect=redirect)
63 63
 
@@ -131,12 +131,12 @@ class UpdateIKEPolicy(forms.SelfHandlingForm):
131 131
                 request, context['ikepolicy_id'], **data)
132 132
             msg = (_('IKE Policy %s was successfully updated.')
133 133
                    % context['name'])
134
-            LOG.debug(msg)
135 134
             messages.success(request, msg)
136 135
             return ikepolicy
137 136
         except Exception as e:
137
+            LOG.info('Failed to update IKE Policy %(id)s: %(exc)s',
138
+                     {'id': context['ikepolicy_id'], 'exc': e})
138 139
             msg = _('Failed to update IKE Policy %s') % context['name']
139
-            LOG.info('%(msg)s: %(exception)s', {'msg': msg, 'exception': e})
140 140
             redirect = reverse(self.failure_url)
141 141
             exceptions.handle(request, msg, redirect=redirect)
142 142
 
@@ -209,12 +209,12 @@ class UpdateIPSecPolicy(forms.SelfHandlingForm):
209 209
                 request, context['ipsecpolicy_id'], **data)
210 210
             msg = (_('IPSec Policy %s was successfully updated.')
211 211
                    % context['name'])
212
-            LOG.debug(msg)
213 212
             messages.success(request, msg)
214 213
             return ipsecpolicy
215 214
         except Exception as e:
215
+            LOG.info('Failed to update IPSec Policy %(id)s: %(exc)s',
216
+                     {'id': context['ipsecpolicy_id'], 'exc': e})
216 217
             msg = _('Failed to update IPSec Policy %s') % context['name']
217
-            LOG.info('%(msg)s: %(exception)s', {'msg': msg, 'exception': e})
218 218
             redirect = reverse(self.failure_url)
219 219
             exceptions.handle(request, msg, redirect=redirect)
220 220
 
@@ -318,12 +318,12 @@ class UpdateIPSecSiteConnection(forms.SelfHandlingForm):
318 318
                 request, context['ipsecsiteconnection_id'], **data)
319 319
             msg = (_('IPSec Site Connection %s was successfully updated.')
320 320
                    % context['name'])
321
-            LOG.debug(msg)
322 321
             messages.success(request, msg)
323 322
             return ipsecsiteconnection
324 323
         except Exception as e:
324
+            LOG.info('Failed to update IPSec Site Connection %(id)s: %(exc)s',
325
+                     {'id': context['ipsecsiteconnection_id'], 'exc': e})
325 326
             msg = (_('Failed to update IPSec Site Connection %s')
326 327
                    % context['name'])
327
-            LOG.info('%(msg)s: %(exception)s', {'msg': msg, 'exception': e})
328 328
             redirect = reverse(self.failure_url)
329 329
             exceptions.handle(request, msg, redirect=redirect)

Loading…
Cancel
Save