~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/makeuser.py

Replaced Python config files (conf.py) with new config files system, using
    configobj (INI-file style config files).

setup.py config now produces ./etc/ivle.conf, a new-style config file.
ivle/conf/conf.py is now part of the IVLE source code. It reads the new config
file and provides the same legacy interface, so all of IVLE still functions,
including setup.py config.

Added /etc to the source tree (config files will be stored here).
Added configobj as a dependency in doc/setup/install_proc.txt.

setup.py install copies ./etc/ivle.conf into /etc/ivle/ivle.conf.

Removed boilerplate code generation from setup/configure.py (that code is now
part of ivle/conf/conf.py which is now in the source tree).

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
    """
80
80
    users = store.find(ivle.database.User)
81
81
    groups = {}
82
 
    # TODO: Populate groups with per-offering tutors/lecturers/etc.
 
82
    for u in users:
 
83
        role = str(u.role)
 
84
        if role not in groups:
 
85
            groups[role] = []
 
86
        groups[role].append(u.login)
83
87
    f = open(ivle.conf.svn_conf + ".new", "w")
84
88
    f.write("# IVLE SVN Repositories Configuration\n")
85
89
    f.write("# Auto-generated on %s\n" % time.asctime())
193
197
        raise Exception("Must run make_jail as root")
194
198
    
195
199
    # tempdir is for putting backup homes in
196
 
    tempdir = os.path.join(ivle.conf.jail_src_base, '__temp__')
 
200
    tempdir = os.path.join(ivle.conf.jail_base, '__temp__')
197
201
    if not os.path.exists(tempdir):
198
202
        os.makedirs(tempdir)
199
203
    elif not os.path.isdir(tempdir):
223
227
        # Change the ownership of all the files to the right unixid
224
228
        logging.debug("chown %s's home directory files to uid %d"
225
229
            %(user.login, user.unixid))
226
 
        os.spawnvp(os.P_WAIT, 'chown', ['chown', '-R', '%d:%d' % (user.unixid,
227
 
                                        user.unixid), userhomedir])
 
230
        os.chown(userhomedir, user.unixid, user.unixid)
 
231
        for root, dirs, files in os.walk(userhomedir):
 
232
            for fsobj in dirs + files:
 
233
                os.chown(os.path.join(root, fsobj), user.unixid, user.unixid)
228
234
    else:
229
235
        # No user jail exists
230
236
        # Set up the user's home directory