From: Torsten Werner Date: Thu, 30 Dec 2010 17:10:54 +0000 (+0000) Subject: add option --no-action to import-keyring X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c64115d99acd99476cf957119b75a619390a75c;p=dak add option --no-action to import-keyring Signed-off-by: Torsten Werner --- diff --git a/dak/import_keyring.py b/dak/import_keyring.py index 849e064f..6f366d85 100755 --- a/dak/import_keyring.py +++ b/dak/import_keyring.py @@ -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 = {}