]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Cisco: logging incorrectly called with (fmt, arg) tuple
authorAngus Lees <gus@inodes.org>
Mon, 22 Dec 2014 04:11:07 +0000 (15:11 +1100)
committerAngus Lees <gus@inodes.org>
Mon, 22 Dec 2014 04:11:07 +0000 (15:11 +1100)
cisco.db.n1kv_db_v2._validate_segment_range_uniqueness() includes these
lines:

   msg = (_("NetworkProfile name %s already exists"),
          net_p["name"])
   LOG.error(msg)
   raise n_exc.InvalidInput(error_message=msg)

As written, msg is a tuple, and the various logging lines below print
the tuple members without properly expanding the format string as
intended.

The format in msg should have been expanded using % - as was presumably
the intention.  This change fixes this and a similar example elsewhere
in this file.

Change-Id: I993245a18ff3db5d5700fb1298ffc958d5827736
Closes-Bug: #1404785

neutron/plugins/cisco/db/n1kv_db_v2.py

index 44c51fbb2d11555165f1e4ee14c830552fd796c4..0f8543a100f40dc027740c5893dc807923edebd1 100644 (file)
@@ -593,7 +593,7 @@ def sync_vxlan_allocations(db_session, net_p):
     """
     seg_min, seg_max = get_segment_range(net_p)
     if seg_max + 1 - seg_min > c_const.MAX_VXLAN_RANGE:
-        msg = (_("Unreasonable vxlan ID range %(vxlan_min)s - %(vxlan_max)s"),
+        msg = (_("Unreasonable vxlan ID range %(vxlan_min)s - %(vxlan_max)s") %
                {"vxlan_min": seg_min, "vxlan_max": seg_max})
         raise n_exc.InvalidInput(error_message=msg)
     with db_session.begin(subtransactions=True):
@@ -1418,7 +1418,7 @@ class NetworkProfile_db_mixin(object):
                 name = profile.name
                 segment_range = profile.segment_range
                 if net_p["name"] == name:
-                    msg = (_("NetworkProfile name %s already exists"),
+                    msg = (_("NetworkProfile name %s already exists") %
                            net_p["name"])
                     LOG.error(msg)
                     raise n_exc.InvalidInput(error_message=msg)