1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#!/usr/bin/python2.4
#
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
import sys
import logging
import optparse
from canonical.poppy.server import run_server
from lp.archiveuploader.poppyinterface import PoppyInterface
from canonical.launchpad.scripts import logger, logger_options
def main():
parser = optparse.OptionParser()
logger_options(parser)
parser.add_option("--cmd", action="store", metavar="CMD",
help="Run CMD after each upload completion")
parser.add_option("--allow-user", action="store", metavar="USER",
default='ubuntu',
help="Username allowed to log in.")
parser.add_option("--permissions", action="store", metavar="PERMS",
default='g+rwxs',
help="Permissions to chmod the targetfsroot with "
"before letting go of the directory.")
options, args = parser.parse_args()
log = logger(options, "poppy-upload")
if len(args) != 2:
print "usage: poppy-upload.py rootuploaddirectory port"
return 1
root, port = args
# host = "127.0.0.1"
# host = "82.211.81.167" # Drescher's public IP
host = "0.0.0.0"
ident = "lucille upload server"
numthreads = 4
iface = PoppyInterface(root, log, allow_user=options.allow_user,
cmd=options.cmd,
perms=options.permissions)
run_server(host, int(port), ident, numthreads,
iface.new_client_hook, iface.client_done_hook,
iface.auth_verify_hook)
return 0
if __name__ == '__main__':
sys.exit(main())
|