Jcrespo has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/324685

Change subject: mariadb: ignore '' in private data check, print results as we 
get them
......................................................................

mariadb: ignore '' in private data check, print results as we get them

* Check that the results are not null, '' or 0
* Print a comment as soon as results are found, instead of waiting
  until the end, for debugging purposes

Bug: T150802
Change-Id: I6f1db4a6a5a806115e78cc433e944d141c2e71cc
---
M modules/role/files/mariadb/check_private_data.py
1 file changed, 5 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/85/324685/1

diff --git a/modules/role/files/mariadb/check_private_data.py 
b/modules/role/files/mariadb/check_private_data.py
index afcbca7..341505b 100644
--- a/modules/role/files/mariadb/check_private_data.py
+++ b/modules/role/files/mariadb/check_private_data.py
@@ -119,14 +119,15 @@
     try:
         query = ("SELECT count(*)"
                  " FROM `{}`.`{}`"
-                 " WHERE IF(`{}` IS NULL, 0, `{}` <> '0')").format(database,
-                                                                   table,
-                                                                   column,
-                                                                   column)
+                 " WHERE IF(`{}` IS NULL, 0,"
+                 "          `{}` NOT IN ('0', ''))").format(database, table,
+                                                            column, column)
         cursor.execute(query)
         result = cursor.fetchall()
         if int(result[0][0]) > 0:
             has_private_data = True
+            print('-- Found private data: {}.{} {}'.format(database, table,
+                                                           column, column))
     # Ignore "table doesn't exist" errors
     except pymysql.err.ProgrammingError:
         pass

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6f1db4a6a5a806115e78cc433e944d141c2e71cc
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Jcrespo <jcre...@wikimedia.org>

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

Reply via email to