[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master] update-db: correct check for `DB::Role` set in config



`cnf.get(...)` returns an empty string and not None when the option is
not set.

Reported-by: Nicolas Kessler <uleki@student.kit.edu>
Reference: https://lists.debian.org/debian-dak/2017/10/msg00007.html
---
 dak/update_db.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dak/update_db.py b/dak/update_db.py
index 63d9a64d..19f5fd00 100755
--- a/dak/update_db.py
+++ b/dak/update_db.py
@@ -138,7 +138,7 @@ Updates dak's database schema to the lastest version. You should disable crontab
             self.db = psycopg2.connect(connect_str)
 
             db_role = cnf.get("DB::Role")
-            if db_role is not None:
+            if db_role:
                 self.db.cursor().execute('SET ROLE "{}"'.format(db_role))
 
         except Exception as e:
-- 
2.11.0


Reply to: