]> git.decadent.org.uk Git - dak.git/commitdiff
dominate: Do not attempt delete rows during dry-run
authorNiels Thykier <niels@thykier.net>
Thu, 31 Dec 2015 11:14:34 +0000 (11:14 +0000)
committerNiels Thykier <niels@thykier.net>
Thu, 31 Dec 2015 11:14:34 +0000 (11:14 +0000)
Without the proper permissions, this will fail even if the transaction
would always be rolled back later.

dak/dominate.py

index 600d1127d927f0011cab4e4939213080bdf7818e..52f1b17220cea6824e7b6d91deb3ba04e572ca9f 100755 (executable)
@@ -84,12 +84,13 @@ def obsoleteAllAssociations(suite, session):
     return fetch('old_and_unreferenced', query, { 'suite': suite }, session)
 
 def deleteAssociations(table, idList, session):
+    global Options
     query = """
         DELETE
             FROM %s
             WHERE id IN :idList
     """ % table
-    if not idList:
+    if not idList or Options['No-Action']:
         return
     params = {'idList': tuple(idList)}
     session.execute(query, params)