Beispiel #1
0
    def main(self):
        xom = self
        args = xom.config.args
        if args.export:
            from devpi_server.importexport import do_export
            #xom.thread_pool.start_one(xom.keyfs.notifier)
            return do_export(args.export, xom)

        if args.import_:
            from devpi_server.importexport import do_import
            # we need to start the keyfs notifier so that import
            # can wait on completion of events
            if args.wait_for_events:
                xom.thread_pool.start_one(xom.keyfs.notifier)
            return do_import(args.import_, xom)

        # creation of app will register handlers of key change events
        # which cannot happen anymore after the tx notifier has started
        with xom.keyfs.transaction():
            res = xom.config.hook.devpiserver_cmdline_run(xom=xom)
            if res is not None:
                return res

        app = xom.create_app()
        with xom.thread_pool.live():
            if xom.is_replica():
                # XXX ground restart_as_write_transaction better
                xom.keyfs.restart_as_write_transaction = None
            return wsgi_run(xom, app)
Beispiel #2
0
    def main(self):
        xom = self
        args = xom.config.args
        if args.upgrade_state:
            from devpi_server.importexport import do_upgrade
            return do_upgrade(xom)

        if args.export:
            from devpi_server.importexport import do_export
            return do_export(args.export, xom)
        configure_logging(xom.config)
        # access extdb to make sure invalidation happens
        xom.extdb
        if args.import_:
            from devpi_server.importexport import do_import
            return do_import(args.import_, xom)
        return bottle_run(xom)
Beispiel #3
0
    def main(self):
        xom = self
        args = xom.config.args
        if args.upgrade_state:
            from devpi_server.importexport import do_upgrade
            return do_upgrade(xom)

        if args.export:
            from devpi_server.importexport import do_export
            return do_export(args.export, xom)
        configure_logging(xom.config)
        # access extdb to make sure invalidation happens
        xom.extdb
        if args.import_:
            from devpi_server.importexport import do_import
            return do_import(args.import_, xom)
        return bottle_run(xom)
Beispiel #4
0
    def main(self):
        xom = self
        args = xom.config.args
        if args.upgrade_state:
            from devpi_server.importexport import do_upgrade
            return do_upgrade(xom)

        # need to initialize the pypi mirror state before importing
        # because importing may need pypi mirroring state
        if xom.is_replica():
            proxy = replica.PyPIProxy(xom._httpsession, xom.config.master_url)
        else:
            proxy = self.proxy
        xom.pypimirror.init_pypi_mirror(proxy)
        if args.export:
            from devpi_server.importexport import do_export
            #xom.thread_pool.start_one(xom.keyfs.notifier)
            return do_export(args.export, xom)

        if args.import_:
            from devpi_server.importexport import do_import
            # we need to start the keyfs notifier so that import
            # can wait on completion of events
            xom.thread_pool.start_one(xom.keyfs.notifier)
            return do_import(args.import_, xom)

        # creation of app will register handlers of key change events
        # which cannot happen anymore after the tx notifier has started
        with xom.keyfs.transaction():
            results = xom.config.hook.devpiserver_run_commands(xom)
            if [x for x in results if x is not None]:
                errors = list(filter(None, results))
                if errors:
                    return errors[0]
                return 0

        app = xom.create_app()
        with xom.thread_pool.live():
            if xom.is_replica():
                # XXX ground restart_as_write_transaction better
                xom.keyfs.restart_as_write_transaction = None
            return wsgi_run(xom, app)
Beispiel #5
0
    def main(self):
        xom = self
        args = xom.config.args
        if args.upgrade_state:
            from devpi_server.importexport import do_upgrade
            return do_upgrade(xom)

        # need to initialize the pypi mirror state before importing
        # because importing may need pypi mirroring state
        if xom.is_replica():
            proxy = replica.PyPIProxy(xom._httpsession, xom.config.master_url)
        else:
            proxy = self.proxy
        xom.pypimirror.init_pypi_mirror(proxy)
        if args.export:
            from devpi_server.importexport import do_export
            #xom.thread_pool.start_one(xom.keyfs.notifier)
            return do_export(args.export, xom)

        if args.import_:
            from devpi_server.importexport import do_import
            # we need to start the keyfs notifier so that import
            # can wait on completion of events
            xom.thread_pool.start_one(xom.keyfs.notifier)
            return do_import(args.import_, xom)

        # creation of app will register handlers of key change events
        # which cannot happen anymore after the tx notifier has started
        with xom.keyfs.transaction():
            results = xom.config.hook.devpiserver_run_commands(xom)
            if [x for x in results if x is not None]:
                errors = list(filter(None, results))
                if errors:
                    return errors[0]
                return 0

        app = xom.create_app()
        with xom.thread_pool.live():
            if xom.is_replica():
                # XXX ground restart_as_write_transaction better
                xom.keyfs.restart_as_write_transaction = None
            return wsgi_run(xom, app)
Beispiel #6
0
def make_export(tmpdir, xom):
    xom.config.init_nodeinfo()
    return do_export(tmpdir, xom)