Exemplo n.º 1
0
                except sr.RepositoryError as e:
                        emsg(str(e), "ADD_CONTENT")
                        sys.exit(1)
                except (search_errors.IndexingException,
                    api_errors.UnknownErrors,
                    api_errors.PermissionsException) as e:
                        emsg(str(e), "INDEX")
                        sys.exit(1)

        # Ready to start depot; exit now if requested.
        if exit_ready:
                sys.exit(0)

        # Next, initialize depot.
        if nasty:
                depot = ds.NastyDepotHTTP(repo, dconf)
        else:
                depot = ds.DepotHTTP(repo, dconf)

        # Now build our site configuration.
        conf = {
            "/": {
                # We have to override cherrypy's default response_class so that
                # we have access to the write() callable to stream data
                # directly to the client.
                "wsgi.response_class": dr.DepotResponse,
            },
            "/robots.txt": {
                "tools.staticfile.on": True,
                "tools.staticfile.filename": os.path.join(depot.web_root,
                    "robots.txt")
Exemplo n.º 2
0
        # Now merge or add our proxy configuration information into the
        # existing configuration.
        for entry in proxy_conf:
            conf["/"][entry] = proxy_conf[entry]

    scfg.acquire_in_flight()
    try:
        scfg.acquire_catalog(rebuild=rebuild, verbose=True)
    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)

    try:
        cherrypy.quickstart(root, config=conf)
    except Exception, _e:
        emsg("pkg.depotd: unknown error starting depot server, " \
            "illegal option value specified?")
        emsg(_e)
        sys.exit(1)