From ad36b8b95ba7822e61da1c6b985ed23317e9a95b Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Thu, 5 Sep 2024 10:36:46 +0200 Subject: [PATCH] frontend: make the default storage for new projects configurable See #2533 --- frontend/coprs_frontend/coprs/config.py | 4 ++++ frontend/coprs_frontend/coprs/logic/coprs_logic.py | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/frontend/coprs_frontend/coprs/config.py b/frontend/coprs_frontend/coprs/config.py index 9797d43c8..2ff757e5c 100644 --- a/frontend/coprs_frontend/coprs/config.py +++ b/frontend/coprs_frontend/coprs/config.py @@ -201,6 +201,10 @@ class Config(object): ROLLING_CHROOTS_INACTIVITY_WARNING = 180 ROLLING_CHROOTS_INACTIVITY_REMOVAL = 180 + # What storage should be set for new projects. + # Possible options are "backend" and "pulp" + DEFAULT_STORAGE = "backend" + class ProductionConfig(Config): DEBUG = False diff --git a/frontend/coprs_frontend/coprs/logic/coprs_logic.py b/frontend/coprs_frontend/coprs/logic/coprs_logic.py index 17c00ec70..2922297ea 100644 --- a/frontend/coprs_frontend/coprs/logic/coprs_logic.py +++ b/frontend/coprs_frontend/coprs/logic/coprs_logic.py @@ -17,7 +17,12 @@ from sqlalchemy.orm.exc import NoResultFound from sqlalchemy.orm.attributes import get_history -from copr_common.enums import ActionTypeEnum, BackendResultEnum, ActionPriorityEnum +from copr_common.enums import ( + ActionTypeEnum, + BackendResultEnum, + ActionPriorityEnum, + StorageEnum, +) from coprs import app, db from coprs import exceptions from coprs import helpers @@ -310,6 +315,7 @@ def add(cls, user, name, selected_chroots, repos=None, description=None, isolation=isolation, follow_fedora_branching=follow_fedora_branching, appstream=appstream, + storage=StorageEnum(app.config["DEFAULT_STORAGE"]), **kwargs)