50
48
os.path.basename(sys.argv[0])
53
config = ivle.config.Config()
54
store = ivle.database.get_store(config)
57
users = store.find(ivle.database.User).order_by(ivle.database.User.login)
59
if len(arguments) == 0:
60
print >> sys.stderr, "must be run with -a or a username"
62
users = [ivle.database.User.get_by_login(store, arguments[0])]
56
if len(arguments) == 0:
57
print >> sys.stderr, "must be run with -a or a username"
59
list = [db.get_user(arguments[0])]
60
res = db.get_all('login', ['login', 'unixid'])
62
return (flds['login'], flds['unixid'])
63
uids = dict(map(repack,res))
64
except Exception, message:
65
logging.error(str(message))
64
68
logging.info("rebuild started")
70
list.sort(key=lambda user: user.login)
68
ivle.makeuser.make_jail(user, config)
75
# Resolve the user's login into a UID
79
raise Exception("user %s does not have a unixid in the database"
81
# Remake the user's jail
82
ivle.makeuser.make_jail(login, uid)
69
83
except Exception, message:
70
logging.error("Failed to recreate jail for %s.\n%s" %
71
(user.login, traceback.format_exc()))
84
logging.warning(str(message))
74
logging.debug("recreated user %s's jail." % user.login)
87
logging.debug("recreated user %s's jail." % login)
76
89
logging.info("rebuild completed successfully")