options.displayed_name = raw_input("Input the group's displayed name [%s]: " % groupname ) if not options.displayed_name or len(options.displayed_name.strip())==0: options.displayed_name = groupname print "Displayed name: %s" % options.displayed_name if not options.grouptype: options.grouptype = raw_input("Input the group's type (%s): " % (','.join(groupdef.list_grouptypes_by_text()))) options.grouptype = groupdef.grouptype_as_id(options.grouptype.strip()) if not options.grouptype: print "Invalid grouptype" exit(0) gm = GroupManager() try: groupadd_res = gm.creategroup(groupname,options.displayed_name,options.grouptype,options.description,options.gid) except Exception, e: print "An error occured while writing to the user LDAP database" print e exit(0) if groupadd_res==-1: print "The group %s already exists" % groupname exit(0) if groupadd_res==-2: print "The system could not map the group to an gid (groupid)" exit(0) if groupadd_res==-3: print "A problem occured while creating the groups's home directory" exit(0) if groupadd_res==-5: print "Displayed name is not set, though it is mandetory"