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

« back to all changes in this revision

Viewing changes to services/usrmgt-server

  • Committer: Matt Giuca
  • Date: 2009-04-28 11:02:02 UTC
  • Revision ID: matt.giuca@gmail.com-20090428110202-pqr7ip8jpnqj199o
ivle.makeuser: mount_jail now requires a config argument
    (Though nobody ever seems to call this function...)

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
import logging
6
6
 
7
7
import ivle.config
 
8
import ivle.conf
8
9
import ivle.database
9
10
import ivle.chat
10
11
import ivle.makeuser
11
12
 
12
 
config = ivle.config.Config()
13
 
 
14
13
# usage:
15
14
#   usrmgt-server <port> <magic>
16
15
 
49
48
    user = ivle.database.User.get_by_login(store, login)
50
49
 
51
50
    # make svn config/auth
52
 
    repopath = os.path.join(config['paths']['svn']['repo_path'],
53
 
                            'users', login)
 
51
    repopath = os.path.join(ivle.conf.svn_repo_path, 'users', login)
54
52
    logging.debug("Creating user's Subversion repository")
55
53
    ivle.makeuser.make_svn_repo(repopath, throw_on_error=True)
56
54
 
109
107
    groupnm = props['groupnm']
110
108
 
111
109
    namespace = "_".join([subj_short_name, year, semester, groupnm])
112
 
    repopath = os.path.join(config['paths']['svn']['repo_path'],
113
 
                            'groups', namespace)
 
110
    repopath = os.path.join(ivle.conf.svn_repo_path, 'groups', namespace)
114
111
    logging.debug("Creating Subversion repository %s"%repopath)
115
112
    try:
116
113
        ivle.makeuser.make_svn_repo(repopath)
131
128
def initializer():
132
129
    logging.basicConfig(filename="/var/log/usrmgt.log", level=logging.INFO)
133
130
    logging.info("Starting usrmgt server on port %d (pid = %d)" %
134
 
                 (config['usrmgt']['port'], pid))
 
131
                 (ivle.conf.usrmgt_port, pid))
135
132
 
136
133
    try:
137
134
        pidfile = open('/var/run/usrmgt-server.pid', 'w')
144
141
def dispatch(props):
145
142
    logging.debug(repr(props))
146
143
 
 
144
    config = ivle.config.Config()
147
145
    store = ivle.database.get_store(config)
148
146
    action = props.keys()[0]
149
147
    res = actions[action](store, props[action], config)
158
156
if __name__ == "__main__":
159
157
    pid = os.getpid()
160
158
 
161
 
    ivle.chat.start_server(config['usrmgt']['port'],config['usrmgt']['magic'],
 
159
    ivle.chat.start_server(ivle.conf.usrmgt_port, ivle.conf.usrmgt_magic,
162
160
                           True, dispatch, initializer)