Пример #1
0
 def setUpClass(cls):
     admin_api.register_views(api.api, api.plans)
     os.environ["MONGO_DATABASE"] = "api_admin_test"
     cls.storage = storage.MongoDBStorage()
     cls.manager = managers.FakeManager(storage=cls.storage)
     api.get_manager = lambda: cls.manager
     cls.api = api.api.test_client()
Пример #2
0
 def setUpClass(cls):
     admin_api.register_views(api.api, api.plans)
     os.environ["MONGO_DATABASE"] = "api_admin_test"
     cls.storage = storage.MongoDBStorage()
     cls.manager = managers.FakeManager(storage=cls.storage)
     api.get_manager = lambda: cls.manager
     cls.api = api.api.test_client()
Пример #3
0
 def setUpClass(cls):
     admin_api.register_views(api.api, api.plans)
     cls.storage = storage.MongoDBStorage()
     cls.manager = managers.FakeManager(storage=cls.storage)
     api.get_manager = lambda: cls.manager
     cls.api = api.api.test_client()
Пример #4
0
        lua_module_type = request.form.get('lua_module_type')
        if lua_module_type not in ("server", "worker"):
            return 'Lua module type should be server or worker.', 400
        if not lua_module:
            return 'You should provide a lua module name.', 400
        get_manager().delete_lua(name, lua_module, lua_module_type)
    except tasks.NotReadyError as e:
        return "Instance not ready: {}".format(e), 412
    return "", 200


@api.route("/plugin", methods=["GET"])
def get_plugin():
    return inspect.getsource(plugin)


@api.route("/admin/plugin", methods=["GET"])
def get_admin_plugin():
    return inspect.getsource(admin_plugin)


admin_api.register_views(api, plans)


def main():
    api.run(host="0.0.0.0", port=int(os.environ.get("PORT", 8888)))


if __name__ == '__main__':
    main()
Пример #5
0
 def setUpClass(cls):
     admin_api.register_views(api.api, api.plans)
     cls.storage = storage.MongoDBStorage()
     cls.manager = managers.FakeManager(storage=cls.storage)
     api.get_manager = lambda: cls.manager
     cls.api = api.api.test_client()
Пример #6
0
        return str(e), 412
    except Exception, e:
        if api.debug:
            raise e
        return 'Unexpected error', 500
    return "", 200


@api.route("/plugin", methods=["GET"])
def get_plugin():
    return inspect.getsource(plugin)


@api.route("/admin/plugin", methods=["GET"])
def get_admin_plugin():
    return inspect.getsource(admin_plugin)


def require_plan():
    return "RPAAS_REQUIRE_PLAN" in os.environ

admin_api.register_views(api, plans)


def main():
    api.run(host="0.0.0.0", port=int(os.environ.get("PORT", 8888)))


if __name__ == '__main__':
    main()
Пример #7
0
        lua_module_type = request.form.get('lua_module_type')
        if lua_module_type not in ("server", "worker"):
            return 'Lua module type should be server or worker.', 400
        if not lua_module:
            return 'You should provide a lua module name.', 400
        get_manager().delete_lua(name, lua_module, lua_module_type)
    except tasks.NotReadyError as e:
        return "Instance not ready: {}".format(e), 412
    return "", 200


@api.route("/plugin", methods=["GET"])
def get_plugin():
    return inspect.getsource(plugin)


@api.route("/admin/plugin", methods=["GET"])
def get_admin_plugin():
    return inspect.getsource(admin_plugin)


admin_api.register_views(api, plans, flavors)


def main():
    api.run(host="0.0.0.0", port=int(os.environ.get("PORT", 8888)))


if __name__ == '__main__':
    main()
Пример #8
0
Файл: api.py Проект: tsuru/rpaas
        lua_module_type = request.form.get('lua_module_type')
        if lua_module_type not in ("server", "worker"):
            return 'Lua module type should be server or worker.', 400
        if not lua_module:
            return 'You should provide a lua module name.', 400
        get_manager().delete_lua(name, lua_module, lua_module_type)
    except tasks.NotReadyError as e:
        return "Instance not ready: {}".format(e), 412
    return "", 200


@api.route("/plugin", methods=["GET"])
def get_plugin():
    return inspect.getsource(plugin)


@api.route("/admin/plugin", methods=["GET"])
def get_admin_plugin():
    return inspect.getsource(admin_plugin)


admin_api.register_views(api, plans, flavors)


def main():
    api.run(host="0.0.0.0", port=int(os.environ.get("PORT", 8888)))


if __name__ == '__main__':
    main()