[Checkins] SVN: cipher.googlepam/trunk/ add-google-users: --exclude option

Marius Gedminas cvs-admin at zope.org
Tue Oct 9 08:37:17 UTC 2012


Log message for revision 127948:
  add-google-users: --exclude option

Changed:
  U   cipher.googlepam/trunk/CHANGES.txt
  U   cipher.googlepam/trunk/src/cipher/googlepam/addusers.py

-=-
Modified: cipher.googlepam/trunk/CHANGES.txt
===================================================================
--- cipher.googlepam/trunk/CHANGES.txt	2012-10-09 08:37:09 UTC (rev 127947)
+++ cipher.googlepam/trunk/CHANGES.txt	2012-10-09 08:37:14 UTC (rev 127948)
@@ -7,6 +7,10 @@
 - Support multiple Google groups.  The authenticating user has to be a member
   of any one of them for access to be allowed.
 
+- Added add-google-users new option --exclude to skip adding some users
+  (e.g. the 'admin' user might clash with an existing 'admin' group, causing
+  the script to fail).
+
 - Added add-google-users option --add-to-group as a more meaningful alias for
   the old --admin-group option.
 

Modified: cipher.googlepam/trunk/src/cipher/googlepam/addusers.py
===================================================================
--- cipher.googlepam/trunk/src/cipher/googlepam/addusers.py	2012-10-09 08:37:09 UTC (rev 127947)
+++ cipher.googlepam/trunk/src/cipher/googlepam/addusers.py	2012-10-09 08:37:14 UTC (rev 127948)
@@ -93,6 +93,9 @@
     users = []
     for email in emails:
         entry = apps_srv.RetrieveUser(email.split('@')[0])
+        if options.exclude and entry.login.user_name in options.exclude:
+            log.info('Skipping %s (%s)', entry.login.user_name, email)
+            continue
         users.append({
             'full_name': '%s %s' %(entry.name.given_name,
                                    entry.name.family_name),
@@ -139,6 +142,11 @@
     help='The Unix group to which the user will be added.')
 
 parser.add_option(
+    '-x', '--exclude', metavar='USERNAME', action='append',
+    dest='exclude',
+    help='Do not add these users.')
+
+parser.add_option(
     '-c', '--command', action='store',
     dest='command', default=ADDUSER_CMD,
     help='The command used to create the user (default: %default).')



More information about the checkins mailing list