]> git.decadent.org.uk Git - dak.git/commitdiff
add option --no-action to import-keyring
authorTorsten Werner <twerner@debian.org>
Thu, 30 Dec 2010 17:10:54 +0000 (17:10 +0000)
committerTorsten Werner <twerner@debian.org>
Fri, 31 Dec 2010 10:50:05 +0000 (11:50 +0100)
Signed-off-by: Torsten Werner <twerner@debian.org>
dak/import_keyring.py

index 849e064f8d5a88da55eb9ee402434eea110c7a79..6f366d859548e357da70716169c11d6e10080c52 100755 (executable)
@@ -70,7 +70,8 @@ def usage (exit_code=0):
   -h, --help                  show this help and exit.
   -L, --import-ldap-users     generate uid entries for keyring from LDAP
   -U, --generate-users FMT    generate uid entries from keyring as FMT
-  -l, --list-uids STRING      list all uids matching *STRING*"""
+  -l, --list-uids STRING      list all uids matching *STRING*
+  -n, --no-action             don't change database"""
     sys.exit(exit_code)
 
 
@@ -84,9 +85,11 @@ def main():
                  ('L',"import-ldap-users","Import-Keyring::Options::Import-Ldap-Users"),
                  ('U',"generate-users","Import-Keyring::Options::Generate-Users", "HasArg"),
                  ('l',"list-uids","Import-Keyring::Options::List-UIDs", "HasArg"),
+                 ('n',"no-action","Import-Keyring::Options::No-Action"),
                 ]
 
-    for i in [ "help", "report-changes", "generate-users", "import-ldap-users", "list-uids"]:
+    for i in [ "help", "report-changes", "generate-users",
+           "import-ldap-users", "list-uids", "no-action" ]:
         if not cnf.has_key("Import-Keyring::Options::%s" % (i)):
             cnf["Import-Keyring::Options::%s" % (i)] = ""
 
@@ -271,7 +274,10 @@ def main():
                                                                                        keyring.keyring_name)
 
     # All done!
-    session.commit()
+    if Options["No-Action"]:
+       session.rollback()
+    else:
+       session.commit()
 
     # Print a summary
     changesd = {}