Browse Source

nlbaas2octavia: Escape 'key' field calls

The word "key" is reserved in SQL. lbaas_l7rules table has a field
name "key" which using it unescaped raises a mysql exception.

Change-Id: Ic0ddc86fe361014972f2a728beb3e8a3ed20e785
Kobi Samoray 8 months ago
parent
commit
82032ec987
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      tools/nlbaas2octavia/nlbaas2octavia.py

+ 2
- 2
tools/nlbaas2octavia/nlbaas2octavia.py View File

@@ -264,7 +264,7 @@ def process_L7policies(LOG, n_session, o_session, listener_id, project_id):
264 264
                             'database.'))
265 265
         # Handle L7 rules
266 266
         l7rules = n_session.execute(
267
-            "SELECT id, type, compare_type, invert, key, value, "
267
+            "SELECT id, type, compare_type, invert, `key`, value, "
268 268
             "provisioning_status, admin_state_up FROM lbaas_l7rules WHERE "
269 269
             "l7policy_id = :l7policy_id AND provisioning_status = 'ACTIVE';",
270 270
             {'l7policy_id': l7policy[0]}).fetchall()
@@ -281,7 +281,7 @@ def process_L7policies(LOG, n_session, o_session, listener_id, project_id):
281 281
 
282 282
             result = o_session.execute(
283 283
                 "INSERT INTO l7rule (id, l7policy_id, type, compare_type, "
284
-                "key, value, invert, provisioning_status, created_at, "
284
+                "`key`, value, invert, provisioning_status, created_at, "
285 285
                 "updated_at, project_id, enabled, operating_status) VALUES "
286 286
                 "(:id, :l7policy_id, :type, :compare_type, :key, :value, "
287 287
                 ":invert, :provisioning_status, :created_at, :updated_at, "

Loading…
Cancel
Save