Jcrespo has submitted this change and it was merged.

Change subject: mariadb: Update check private data script to handle BINARY 
fields
......................................................................


mariadb: Update check private data script to handle BINARY fields

We need to trim \0 (unicode/asci code 0), as BINARY fields store
empty string values as \0\0\0... n times, being n the width of the
binary field.

Bug: T152194
Change-Id: I744ba0fd8c1448760b9a71f7b1dc4af75aba22b1
---
M modules/role/files/mariadb/check_private_data.py
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Jcrespo: Looks good to me, approved
  Marostegui: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/modules/role/files/mariadb/check_private_data.py 
b/modules/role/files/mariadb/check_private_data.py
index 341505b..769be5a 100644
--- a/modules/role/files/mariadb/check_private_data.py
+++ b/modules/role/files/mariadb/check_private_data.py
@@ -120,8 +120,8 @@
         query = ("SELECT count(*)"
                  " FROM `{}`.`{}`"
                  " WHERE IF(`{}` IS NULL, 0,"
-                 "          `{}` NOT IN ('0', ''))").format(database, table,
-                                                            column, column)
+                 "          TRIM(LEADING '\0' FROM `{}`) NOT IN ('0', ''))")
+        query = query.format(database, table, column, column)
         cursor.execute(query)
         result = cursor.fetchall()
         if int(result[0][0]) > 0:

-- 
To view, visit https://gerrit.wikimedia.org/r/325176
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I744ba0fd8c1448760b9a71f7b1dc4af75aba22b1
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Jcrespo <jcre...@wikimedia.org>
Gerrit-Reviewer: Jcrespo <jcre...@wikimedia.org>
Gerrit-Reviewer: Marostegui <maroste...@wikimedia.org>
Gerrit-Reviewer: Volans <rcocci...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to