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

« back to all changes in this revision

Viewing changes to scripts/usrmgt-server

  • Committer: mattgiuca
  • Date: 2008-03-09 21:24:37 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:676
usrmgt-server: Moved SVN checkout code from activate_me into a separate
action, do_checkout, which is called by activate_me. This allows you to do
checkouts later on.

userservice: Added do_checkout action to userservice.

Show diffs side-by-side

added added

removed removed

Lines of Context:
177
177
        cf.write("svn_pass = %s\n" % repr(passwd))
178
178
        cf.close()
179
179
 
180
 
        # FIXME: </hack>
181
 
 
182
 
        logging.debug("Checking out directories in the jail")
183
 
        try:
184
 
            svn.checkout(conf.svn_addr + login + "/stuff",
185
 
                         common.studpath.url_to_local(login + "/stuff")[1])
186
 
        except Exception, exc:
187
 
            logging.warning("While mkdiring stuff: %s" % str(exc))
188
 
            pass
189
 
        try:
190
 
            svn.checkout(conf.svn_addr + login + "/info1",
191
 
                         common.studpath.url_to_local(login + "/info1")[1])
192
 
        except Exception, exc:
193
 
            logging.warning("While mkdiring info1: %s" % str(exc))
194
 
            pass
 
180
        # Check out the repositories into the student's home dir
 
181
        do_checkout(props)
195
182
 
196
183
        # FIXME: should this be nicer?
197
184
        os.system("chown -R %d:%d %s" \
207
194
    finally:
208
195
        db.close()
209
196
 
 
197
def do_checkout(props):
 
198
    """Create the default contents of a user's jail by checking out from the
 
199
    repositories.
 
200
    If any directory already exists, just fail silently (so this is not a
 
201
    "wipe-and-checkout", merely a checkout if it failed or something).
 
202
       Expected properties:
 
203
        login       - the user name for the jail
 
204
                      STRING REQUIRED
 
205
       Return Value: None
 
206
    """
 
207
 
 
208
    login = props['login']
 
209
 
 
210
    # FIXME: </hack>
 
211
 
 
212
    logging.debug("Checking out directories in the jail")
 
213
    try:
 
214
        svn.checkout(conf.svn_addr + login + "/stuff",
 
215
                     common.studpath.url_to_local(login + "/stuff")[1])
 
216
        os.system("chown -R %d:%d %s" \
 
217
                % (details.unixid, details.unixid,
 
218
                   common.studpath.url_to_local(login + "/stuff")[1]))
 
219
    except Exception, exc:
 
220
        logging.warning("While mkdiring stuff: %s" % str(exc))
 
221
        pass
 
222
    try:
 
223
        svn.checkout(conf.svn_addr + login + "/info1",
 
224
                     common.studpath.url_to_local(login + "/info1")[1])
 
225
        os.system("chown -R %d:%d %s" \
 
226
                % (details.unixid, details.unixid,
 
227
                   common.studpath.url_to_local(login + "/info1")[1]))
 
228
    except Exception, exc:
 
229
        logging.warning("While mkdiring info1: %s" % str(exc))
 
230
        pass
 
231
 
 
232
    return {"response": "okay"}
 
233
 
210
234
actions = {
211
235
        'create_user':create_user,
212
236
        'update_user':update_user,
213
237
        'activate_user':activate_user,
 
238
        'do_checkout':do_checkout,
214
239
    }
215
240
 
216
241
def dispatch(props):