[sysadmin-bin] create-auth: Fix up --translation-user option
- From: Owen Taylor <otaylor src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] create-auth: Fix up --translation-user option
- Date: Fri, 6 Sep 2013 16:15:04 +0000 (UTC)
commit 36a78a0b5d9081d64df30bc13666ee256f7d6900
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Thu Sep 5 13:59:39 2013 -0400
create-auth: Fix up --translation-user option
The handling of --translation-user had some quirks - for example,
specifying --translation-user would silently force on inclusion
of all GIT users. Rearrange option handling for --translation-user
so that it works in a more expected way.
https://bugzilla.gnome.org/show_bug.cgi?id=599066
create-auth | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/create-auth b/create-auth
index bba96bb..819deb2 100755
--- a/create-auth
+++ b/create-auth
@@ -310,7 +310,7 @@ def lookup_user_info(uids):
return _get_user_data_from_ldap(filter)
-def build_user_hash(group_list, restrict=None):
+def build_user_hash(group_list, options):
users = set()
gnomevcs_users = set()
@@ -322,13 +322,13 @@ def build_user_hash(group_list, restrict=None):
users.update(sysadmin)
for group in group_list:
users.update(get_uids_from_group(group, force_ldap=True))
- if restrict in ('gnomegit', 'gnomegit-i18n', 'mango'):
+ if options.restrict in ('gnomegit', 'mango'):
gnomevcs_users = (get_uids_from_group('gnomecvs', force_ldap=True) | get_uids_from_group('gnomevcs',
force_ldap=True)) - users
- if restrict == 'gnomegit-i18n':
+ if options.translation_user:
gnomevcs_users.update(['translations'])
- elif restrict == 'nagios':
+ elif options.restrict == 'nagios':
gnomevcs_users = get_uids_from_group('nagios', force_ldap=True) - users
- elif restrict == 'rrsync':
+ elif options.restrict == 'rrsync':
gnomevcs_users = get_uids_from_group('ftpbasic', force_ldap=True) - users
# look up their keys (if we have them)
@@ -338,11 +338,8 @@ def build_user_hash(group_list, restrict=None):
if uid not in user_data:
continue
- if restrict == 'gnomegit-i18n':
- if uid == 'translations':
- user_data[uid]['restrict'] = 'gnomegit-i18n'
- else:
- user_data[uid]['restrict'] = 'gnomegit'
+ if options.restrict == 'gnomegit' and options.translation_user and and uid == 'translations':
+ user_data[uid]['restrict'] = 'gnomegit-i18n'
else:
user_data[uid]['restrict'] = restrict
@@ -434,7 +431,7 @@ if __name__ == '__main__':
parser = OptionParser()
parser.add_option("--restrict",
action="store", dest="restrict", default=None,
- choices=['gnomegit', 'mango', 'rrsync', 'gnomegit-i18n', 'nagios'],
+ choices=['gnomegit', 'mango', 'rrsync', 'nagios'],
help="What type of restricted access to setup")
parser.add_option("--gnomegit",
@@ -445,8 +442,7 @@ if __name__ == '__main__':
action="store_const", dest="restrict", const="mango")
parser.add_option("--nagios",
action="store_const", dest="restrict", const="nagios")
- parser.add_option("--translation-user",
- action="store_const", dest="restrict", const="gnomegit-i18n")
+ parser.add_option("--translation-user", action="store_true")
parser.add_option("--create-all-homedirs",
action="store_const", dest="homedirs", const="all")
@@ -463,6 +459,10 @@ if __name__ == '__main__':
if options.homedirs is not None:
import stat
+ if options.translation_user and restrict != 'gnomegit':
+ print >>sys.stderr, "ERROR: --translation-user only works for --gnome-git"
+ sys.exit(1)
+
if options.homedirs == 'all':
user_list_homedirs = get_homedirs()
old_mask = os.umask(0077)
@@ -471,7 +471,7 @@ if __name__ == '__main__':
print_user_list('Created home directory for', created_users)
# set_homedir_permissions(user_list_homedirs, user_list_homedirs.keys())
- user_data = build_user_hash (group_list, restrict=options.restrict)
+ user_data = build_user_hash (group_list, options)
if not len(user_data):
print >>sys.stderr, "ERROR: No users to create! Likely empty LDAP directory!!"
sys.exit(1)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]