wilde: utils/admin convert-ldif-21.py,1.1,1.2

cvs at kolab.org cvs at kolab.org
Tue Feb 20 15:23:46 CET 2007


Author: wilde

Update of /kolabrepository/utils/admin
In directory doto:/tmp/cvs-serv1527

Modified Files:
	convert-ldif-21.py 
Log Message:
Added new option --list-resources, needed to find old resource accounts,
which might need cyrus acl updates.


Index: convert-ldif-21.py
===================================================================
RCS file: /kolabrepository/utils/admin/convert-ldif-21.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- convert-ldif-21.py	12 Oct 2006 16:18:10 -0000	1.1
+++ convert-ldif-21.py	20 Feb 2007 14:23:43 -0000	1.2
@@ -15,7 +15,7 @@
 
 Usage:
 
-   convert-ldif-21.py [--normalize] [INFILE [OUTFILE]]
+   convert-ldif-21.py [--normalize|--list-resources] [INFILE [OUTFILE]]
 
 The program reads the kolab ldap data from INFILE and writes the
 converted data to OUTFILE.  The data should be in ldif format as
@@ -27,6 +27,9 @@
 written out again without any further modification.  The output data
 will differ only in formatting with.  This can be useful when doing
 comparisons with diff.
+
+When the --list-resources option is given, only a list of all resource
+accounts is printed to stdout.
 """
 
 __version__ = "$Revision$"
@@ -100,6 +103,10 @@
     if record.has_key("kolabEncryptedPassword"):
         del record["kolabEncryptedPassword"]
 
+def print_resource_accounts(dn, record, kolab_config):
+    """Prints out resource accounts"""
+    if record.has_key("kolabEncryptedPassword"):
+        print record["uid"][0]
 
 found_domains_object = 0
 def find_domains_object(dn, record, kolab_config):
@@ -131,10 +138,12 @@
 def main():
     action = "upgrade"
 
-    opts, rest = getopt.getopt(sys.argv[1:], '', ['normalize', 'help'])
+    opts, rest = getopt.getopt(sys.argv[1:], '', ['normalize', 'list-resources', 'help'])
     for optchar, value in opts:
         if optchar == "--normalize":
             action = "normalize"
+        elif optchar == "--list-resources":
+            action = "list-resources"
         elif optchar == "--help":
             print __doc__
             sys.exit(0)
@@ -159,6 +168,9 @@
                     ]
     elif action == "normalize":
         handlers = []
+    elif action == "list-resources":
+        handlers = [print_resource_accounts]
+        outfile = open("/dev/null", "w")
     else:
         print >>sys.stderr, "unknown action %r" % (action,)
         sys.exit(1)





More information about the commits mailing list