From 335c8d3ef3e5d1112a90d2efa267e5f00a2c5357 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=A1bor=20Antal?= <antal@inf.u-szeged.hu>
Date: Mon, 13 Feb 2017 17:36:56 +0100
Subject: [PATCH] Handle log message interpolation by the logger in identity/

According to OpenStack Guideline[1], logged string message should be
interpolated by the logger.

[1]: http://docs.openstack.org/developer/oslo.i18n/guidelines.html#adding-variables-to-log-messages

Change-Id: I1d6588093616099a9eef0947c09e038b9e53493a
Related-Bug: #1596829
---
 openstackclient/identity/v2_0/ec2creds.py          | 4 ++--
 openstackclient/identity/v2_0/endpoint.py          | 4 ++--
 openstackclient/identity/v2_0/service.py           | 4 ++--
 openstackclient/identity/v3/consumer.py            | 3 +--
 openstackclient/identity/v3/credential.py          | 4 ++--
 openstackclient/identity/v3/domain.py              | 3 +--
 openstackclient/identity/v3/ec2creds.py            | 4 ++--
 openstackclient/identity/v3/endpoint.py            | 3 +--
 openstackclient/identity/v3/federation_protocol.py | 4 ++--
 openstackclient/identity/v3/identity_provider.py   | 4 ++--
 openstackclient/identity/v3/mapping.py             | 3 +--
 openstackclient/identity/v3/policy.py              | 3 +--
 openstackclient/identity/v3/region.py              | 3 +--
 openstackclient/identity/v3/service.py             | 4 ++--
 openstackclient/identity/v3/service_provider.py    | 4 ++--
 15 files changed, 24 insertions(+), 30 deletions(-)

diff --git a/openstackclient/identity/v2_0/ec2creds.py b/openstackclient/identity/v2_0/ec2creds.py
index 2572c4f0bd..0bc48322bc 100644
--- a/openstackclient/identity/v2_0/ec2creds.py
+++ b/openstackclient/identity/v2_0/ec2creds.py
@@ -122,8 +122,8 @@ class DeleteEC2Creds(command.Command):
             except Exception as e:
                 result += 1
                 LOG.error(_("Failed to delete EC2 credentials with "
-                          "access key '%(access_key)s': %(e)s")
-                          % {'access_key': access_key, 'e': e})
+                          "access key '%(access_key)s': %(e)s"),
+                          {'access_key': access_key, 'e': e})
 
         if result > 0:
             total = len(parsed_args.access_keys)
diff --git a/openstackclient/identity/v2_0/endpoint.py b/openstackclient/identity/v2_0/endpoint.py
index 7e0751a7ef..1628e48813 100644
--- a/openstackclient/identity/v2_0/endpoint.py
+++ b/openstackclient/identity/v2_0/endpoint.py
@@ -102,8 +102,8 @@ class DeleteEndpoint(command.Command):
             except Exception as e:
                 result += 1
                 LOG.error(_("Failed to delete endpoint with "
-                          "ID '%(endpoint)s': %(e)s")
-                          % {'endpoint': endpoint, 'e': e})
+                          "ID '%(endpoint)s': %(e)s"),
+                          {'endpoint': endpoint, 'e': e})
 
         if result > 0:
             total = len(parsed_args.endpoints)
diff --git a/openstackclient/identity/v2_0/service.py b/openstackclient/identity/v2_0/service.py
index f70f0fa9db..80f2d72a98 100644
--- a/openstackclient/identity/v2_0/service.py
+++ b/openstackclient/identity/v2_0/service.py
@@ -114,8 +114,8 @@ class DeleteService(command.Command):
             except Exception as e:
                 result += 1
                 LOG.error(_("Failed to delete service with "
-                          "name or ID '%(service)s': %(e)s")
-                          % {'service': service, 'e': e})
+                          "name or ID '%(service)s': %(e)s"),
+                          {'service': service, 'e': e})
 
         if result > 0:
             total = len(parsed_args.services)
diff --git a/openstackclient/identity/v3/consumer.py b/openstackclient/identity/v3/consumer.py
index bcb29db4dc..6dd24dccf1 100644
--- a/openstackclient/identity/v3/consumer.py
+++ b/openstackclient/identity/v3/consumer.py
@@ -73,8 +73,7 @@ class DeleteConsumer(command.Command):
             except Exception as e:
                 result += 1
                 LOG.error(_("Failed to delete consumer with name or "
-                          "ID '%(consumer)s': %(e)s")
-                          % {'consumer': i, 'e': e})
+                          "ID '%(consumer)s': %(e)s"), {'consumer': i, 'e': e})
 
         if result > 0:
             total = len(parsed_args.consumer)
diff --git a/openstackclient/identity/v3/credential.py b/openstackclient/identity/v3/credential.py
index 68287f2a39..2fd0062610 100644
--- a/openstackclient/identity/v3/credential.py
+++ b/openstackclient/identity/v3/credential.py
@@ -99,8 +99,8 @@ class DeleteCredential(command.Command):
             except Exception as e:
                 result += 1
                 LOG.error(_("Failed to delete credentials with "
-                          "ID '%(credential)s': %(e)s")
-                          % {'credential': i, 'e': e})
+                          "ID '%(credential)s': %(e)s"),
+                          {'credential': i, 'e': e})
 
         if result > 0:
             total = len(parsed_args.credential)
diff --git a/openstackclient/identity/v3/domain.py b/openstackclient/identity/v3/domain.py
index 59ab0f0772..064624ab45 100644
--- a/openstackclient/identity/v3/domain.py
+++ b/openstackclient/identity/v3/domain.py
@@ -111,8 +111,7 @@ class DeleteDomain(command.Command):
             except Exception as e:
                 result += 1
                 LOG.error(_("Failed to delete domain with name or "
-                          "ID '%(domain)s': %(e)s")
-                          % {'domain': i, 'e': e})
+                          "ID '%(domain)s': %(e)s"), {'domain': i, 'e': e})
 
         if result > 0:
             total = len(parsed_args.domain)
diff --git a/openstackclient/identity/v3/ec2creds.py b/openstackclient/identity/v3/ec2creds.py
index 9854efda70..44e9a2c778 100644
--- a/openstackclient/identity/v3/ec2creds.py
+++ b/openstackclient/identity/v3/ec2creds.py
@@ -140,8 +140,8 @@ class DeleteEC2Creds(command.Command):
             except Exception as e:
                 result += 1
                 LOG.error(_("Failed to delete EC2 credentials with "
-                          "access key '%(access_key)s': %(e)s")
-                          % {'access_key': i, 'e': e})
+                          "access key '%(access_key)s': %(e)s"),
+                          {'access_key': i, 'e': e})
 
         if result > 0:
             total = len(parsed_args.access_key)
diff --git a/openstackclient/identity/v3/endpoint.py b/openstackclient/identity/v3/endpoint.py
index 39fd49efd1..7bc5e6df74 100644
--- a/openstackclient/identity/v3/endpoint.py
+++ b/openstackclient/identity/v3/endpoint.py
@@ -122,8 +122,7 @@ class DeleteEndpoint(command.Command):
             except Exception as e:
                 result += 1
                 LOG.error(_("Failed to delete endpoint with "
-                          "ID '%(endpoint)s': %(e)s")
-                          % {'endpoint': i, 'e': e})
+                          "ID '%(endpoint)s': %(e)s"), {'endpoint': i, 'e': e})
 
         if result > 0:
             total = len(parsed_args.endpoint)
diff --git a/openstackclient/identity/v3/federation_protocol.py b/openstackclient/identity/v3/federation_protocol.py
index 0752e8f6f2..6429d934c1 100644
--- a/openstackclient/identity/v3/federation_protocol.py
+++ b/openstackclient/identity/v3/federation_protocol.py
@@ -102,8 +102,8 @@ class DeleteProtocol(command.Command):
             except Exception as e:
                 result += 1
                 LOG.error(_("Failed to delete federation protocol "
-                          "with name or ID '%(protocol)s': %(e)s")
-                          % {'protocol': i, 'e': e})
+                          "with name or ID '%(protocol)s': %(e)s"),
+                          {'protocol': i, 'e': e})
 
         if result > 0:
             total = len(parsed_args.federation_protocol)
diff --git a/openstackclient/identity/v3/identity_provider.py b/openstackclient/identity/v3/identity_provider.py
index 163dcb5f07..e8b3a2f459 100644
--- a/openstackclient/identity/v3/identity_provider.py
+++ b/openstackclient/identity/v3/identity_provider.py
@@ -115,8 +115,8 @@ class DeleteIdentityProvider(command.Command):
             except Exception as e:
                 result += 1
                 LOG.error(_("Failed to delete identity providers with "
-                          "name or ID '%(provider)s': %(e)s")
-                          % {'provider': i, 'e': e})
+                          "name or ID '%(provider)s': %(e)s"),
+                          {'provider': i, 'e': e})
 
         if result > 0:
             total = len(parsed_args.identity_provider)
diff --git a/openstackclient/identity/v3/mapping.py b/openstackclient/identity/v3/mapping.py
index 28080f8957..e729c410c8 100644
--- a/openstackclient/identity/v3/mapping.py
+++ b/openstackclient/identity/v3/mapping.py
@@ -132,8 +132,7 @@ class DeleteMapping(command.Command):
             except Exception as e:
                 result += 1
                 LOG.error(_("Failed to delete mapping with name or "
-                          "ID '%(mapping)s': %(e)s")
-                          % {'mapping': i, 'e': e})
+                          "ID '%(mapping)s': %(e)s"), {'mapping': i, 'e': e})
 
         if result > 0:
             total = len(parsed_args.mapping)
diff --git a/openstackclient/identity/v3/policy.py b/openstackclient/identity/v3/policy.py
index c511652ede..3b6441959b 100644
--- a/openstackclient/identity/v3/policy.py
+++ b/openstackclient/identity/v3/policy.py
@@ -82,8 +82,7 @@ class DeletePolicy(command.Command):
             except Exception as e:
                 result += 1
                 LOG.error(_("Failed to delete policy with name or "
-                          "ID '%(policy)s': %(e)s")
-                          % {'policy': i, 'e': e})
+                          "ID '%(policy)s': %(e)s"), {'policy': i, 'e': e})
 
         if result > 0:
             total = len(parsed_args.policy)
diff --git a/openstackclient/identity/v3/region.py b/openstackclient/identity/v3/region.py
index d3e712e375..69c8b5066a 100644
--- a/openstackclient/identity/v3/region.py
+++ b/openstackclient/identity/v3/region.py
@@ -87,8 +87,7 @@ class DeleteRegion(command.Command):
             except Exception as e:
                 result += 1
                 LOG.error(_("Failed to delete region with "
-                          "ID '%(region)s': %(e)s")
-                          % {'region': i, 'e': e})
+                          "ID '%(region)s': %(e)s"), {'region': i, 'e': e})
 
         if result > 0:
             total = len(parsed_args.region)
diff --git a/openstackclient/identity/v3/service.py b/openstackclient/identity/v3/service.py
index 7daf8919d3..ac8d8d9eef 100644
--- a/openstackclient/identity/v3/service.py
+++ b/openstackclient/identity/v3/service.py
@@ -103,8 +103,8 @@ class DeleteService(command.Command):
             except Exception as e:
                 result += 1
                 LOG.error(_("Failed to delete consumer with type, "
-                          "name or ID '%(service)s': %(e)s")
-                          % {'service': i, 'e': e})
+                          "name or ID '%(service)s': %(e)s"),
+                          {'service': i, 'e': e})
 
         if result > 0:
             total = len(parsed_args.service)
diff --git a/openstackclient/identity/v3/service_provider.py b/openstackclient/identity/v3/service_provider.py
index 459dc00b03..bb2d9917b4 100644
--- a/openstackclient/identity/v3/service_provider.py
+++ b/openstackclient/identity/v3/service_provider.py
@@ -108,8 +108,8 @@ class DeleteServiceProvider(command.Command):
             except Exception as e:
                 result += 1
                 LOG.error(_("Failed to delete service provider with "
-                          "name or ID '%(provider)s': %(e)s")
-                          % {'provider': i, 'e': e})
+                          "name or ID '%(provider)s': %(e)s"),
+                          {'provider': i, 'e': e})
 
         if result > 0:
             total = len(parsed_args.service_provider)