Print this page
305 http_proxy value needs more checking for valid url syntax
2341 Client should be more conservative about closing sockets
4235 Misleading "node name" unknown messages when http_proxy set incorrectly
4495 Want ability to cancel individual file downloads
8902 Need a transport that downloads files by GET
9508 Captive portal test only run during catalog refresh
9613 Implicit refresh should raise InvalidDepotResponseException
9615 EOL clientside search v0
9629 EOL clientside support for filelist
9630 Hostile depot should live with other depot code
9631 HTTPS transport should be more rigorous in verification
9670 More specific error exceptions requested from search
9686 network operations should use accept-encoding when appropriate
9715 The info() operation should use the activity_lock
@@ -126,13 +126,13 @@
emsg(text)
print """\
Usage: /usr/lib/pkg.depotd [-d repo_dir] [-p port] [-s threads]
[-t socket_timeout] [--cfg-file] [--content-root] [--debug]
- [--log-access dest] [--log-errors dest] [--mirror] [--proxy-base url]
- [--readonly] [--rebuild] [--ssl-cert-file] [--ssl-dialog]
- [--ssl-key-file] [--writable-root dir]
+ [--log-access dest] [--log-errors dest] [--mirror] [--nasty]
+ [--proxy-base url] [--readonly] [--rebuild] [--ssl-cert-file]
+ [--ssl-dialog] [--ssl-key-file] [--writable-root dir]
--cfg-file The pathname of the file from which to read and to
write configuration information.
--content-root The file system path to the directory containing the
the static and other web content used by the depot's
@@ -151,10 +151,15 @@
stderr, stdout, none, or an absolute pathname. The
default value is stderr.
--mirror Package mirror mode; publishing and metadata operations
disallowed. Cannot be used with --readonly or
--rebuild.
+ --nasty Instruct the server to misbehave. At random intervals
+ it will time-out, send bad responses, hang up on
+ clients, and generally be hostile. The option
+ takes a value (1 to 100) for how nasty the server
+ should be.
--proxy-base The url to use as the base for generating internal
redirects and content.
--readonly Read-only operation; modifying operations disallowed.
Cannot be used with --mirror or --rebuild.
--rebuild Re-build the catalog from pkgs in depot. Cannot be
@@ -200,10 +205,12 @@
readonly = READONLY_DEFAULT
rebuild = REBUILD_DEFAULT
reindex = REINDEX_DEFAULT
proxy_base = None
mirror = MIRROR_DEFAULT
+ nasty = False
+ nasty_value = 0
repo_config_file = None
ssl_cert_file = None
ssl_key_file = None
ssl_dialog = "builtin"
writable_root = None
@@ -236,13 +243,13 @@
log_routes["access"] = "stdout"
opt = None
try:
long_opts = ["cfg-file=", "content-root=", "debug=", "mirror",
- "proxy-base=", "readonly", "rebuild", "refresh-index",
- "ssl-cert-file=", "ssl-dialog=", "ssl-key-file=",
- "writable-root="]
+ "nasty=", "proxy-base=", "readonly", "rebuild",
+ "refresh-index", "ssl-cert-file=", "ssl-dialog=",
+ "ssl-key-file=", "writable-root="]
for opt in log_opts:
long_opts.append("%s=" % opt.lstrip('--'))
opts, pargs = getopt.getopt(sys.argv[1:], "d:np:s:t:",
long_opts)
for opt, arg in opts:
@@ -294,10 +301,23 @@
"You must specify a log " \
"destination."
log_routes[opt.lstrip("--log-")] = arg
elif opt == "--mirror":
mirror = True
+ elif opt == "--nasty":
+ value_err = None
+ try:
+ nasty_value = int(arg)
+ except ValueError, e:
+ value_err = e
+
+ if value_err or (nasty_value > 100 or
+ nasty_value < 1):
+ raise OptionError, "Invalid value " \
+ "for nasty option.\n Please " \
+ "choose a value between 1 and 100."
+ nasty = True
elif opt == "--proxy-base":
# Attempt to decompose the url provided into
# its base parts. This is done so we can
# remove any scheme information since we
# don't need it.
@@ -441,10 +461,16 @@
# Not applicable for reindexing operations.
content_root = None
fork_allowed = not reindex
+ if nasty:
+ scfg = config.NastySvrConfig(repo_path, content_root,
+ AUTH_DEFAULT, auto_create=not readonly,
+ fork_allowed=fork_allowed, writable_root=writable_root)
+ scfg.set_nasty(nasty_value)
+ else:
scfg = config.SvrConfig(repo_path, content_root, AUTH_DEFAULT,
auto_create=not readonly, fork_allowed=fork_allowed,
writable_root=writable_root)
if readonly:
@@ -451,10 +477,11 @@
scfg.set_read_only()
if mirror:
scfg.set_mirror()
+
try:
scfg.init_dirs()
except (errors.SvrConfigError, EnvironmentError), _e:
print "pkg.depotd: an error occurred while trying to " \
"initialize the depot repository directory " \
@@ -626,10 +653,14 @@
except (catalog.CatalogPermissionsException, errors.SvrConfigError), _e:
emsg("pkg.depotd: %s" % _e)
sys.exit(1)
try:
+ if nasty:
+ root = cherrypy.Application(depot.NastyDepotHTTP(scfg,
+ repo_config_file))
+ else:
root = cherrypy.Application(depot.DepotHTTP(scfg,
repo_config_file))
except rc.InvalidAttributeValueError, _e:
emsg("pkg.depotd: repository.conf error: %s" % _e)
sys.exit(1)