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

« back to all changes in this revision

Viewing changes to makeuser.py

  • Committer: wagrant
  • Date: 2008-09-18 09:23:56 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:1050
setup: Don't give possible options in the top-level usage string.
setup.build: Bail out if there is no jail and we've not been told to
             build one.
setup.setuputil: Don't import pysvn except where it is needed, so we
                 can at least display the usage without extra deps.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
import sys
31
31
import os
32
 
import os.path
33
 
import pwd
34
32
import getopt
35
 
# Import modules from the website is tricky since they're in the www
36
 
# directory.
37
 
sys.path.append(os.path.join(os.getcwd(), 'www'))
38
 
import conf
39
 
import common.makeuser, common.db
 
33
import common.makeuser
40
34
 
41
35
# Requireds and optionals will be used to display the usage message
42
36
# AND do argument processing
84
78
    user['nick'] = user['fullname']
85
79
 
86
80
try:
87
 
    # Resolve the user's username into a UID
88
 
    # Create the user if it does not exist
89
 
    try:
90
 
        (_,_,uid,_,_,_,_) = pwd.getpwnam(login)
91
 
    except KeyError:
92
 
        if os.system("useradd '%s'" % login) != 0:
93
 
            raise Exception("Failed to add Unix user account")
94
 
        try:
95
 
            (_,_,uid,_,_,_,_) = pwd.getpwnam(login)
96
 
        except KeyError:
97
 
            raise Exception("Failed to add Unix user account")
98
 
    user['unixid'] = uid
99
 
    # Make the user's jail
100
 
    common.makeuser.make_jail(login, uid)
101
81
    # Make the user's database entry
102
82
    common.makeuser.make_user_db(**user)
103
83
except Exception, message: