Check if the group exists

When setting default group, we should check if the group exists.
If not, it could lead to some issues with adding new users after
the new default group is set.

https://fedorahosted.org/freeipa/ticket/504
This commit is contained in:
Jan Zeleny authored and Rob Crittenden committed 2010-12-06 11:25:25 -05:00
1 parent 9a5d4f2e18
commit 19049d1a64
1 file changed
+6
+6
View File
@@ -149,6 +149,12 @@ class config_mod(LDAPUpdate):
entry_attrs['ipamigrationenabled'] = 'TRUE'
else:
entry_attrs['ipamigrationenabled'] = 'FALSE'
if 'ipadefaultprimarygroup' in entry_attrs:
group=entry_attrs['ipadefaultprimarygroup']
try:
api.Command['group_show'](group)
except errors.NotFound:
raise errors.NotFound(message=unicode("The group doesn't exist"))
return dn
api.register(config_mod)