From 4daf81aa5b8d9140ae2295548d22566b07f64a71 Mon Sep 17 00:00:00 2001 From: Jakub Kuczys <6032823+jack1142@users.noreply.github.com> Date: Sun, 14 Aug 2022 19:57:15 +0200 Subject: [PATCH] Bump Lavalink.jar version and update the default application.yml (#5823) * Bump Lavalink.jar version * Update the default Lavalink YAML file * Let's add schema migration too... * Fix migration (but still actually untested) --- .../audio/core/utilities/miscellaneous.py | 19 +++++++++++++++++++ redbot/cogs/audio/manager.py | 2 +- redbot/cogs/audio/utils.py | 6 +++--- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/redbot/cogs/audio/core/utilities/miscellaneous.py b/redbot/cogs/audio/core/utilities/miscellaneous.py index 585af4186..c91ffd0de 100644 --- a/redbot/cogs/audio/core/utilities/miscellaneous.py +++ b/redbot/cogs/audio/core/utilities/miscellaneous.py @@ -338,6 +338,25 @@ class MiscellaneousUtilities(MixinMeta, metaclass=CompositeMetaClass): await p.save() await self.config.custom(scope).clear() await self.config.schema_version.set(3) + if from_version < 4 <= to_version: + # At the time of the introduction of this schema migration, + # none of these were settable by users even though they're registered in Config + # so this shouldn't have ever been set but there's no real harm in doing this + # and schema migrations are a good practice. + global_data = await self.config.all() + # We're intentionally not setting entire `global_data` to + # avoid storing the default values when they were not already set. + logging_data = global_data.get("yaml", {}).get("logging", {}) + max_history = logging_data.get("file", {}).pop("max_history", ...) + if max_history is not ...: + await self.config.yaml.logging.logback.rollingpolicy.max_history.set(max_history) + max_size = logging_data.get("file", {}).pop("max_size", ...) + if max_size is not ...: + await self.config.yaml.logging.logback.rollingpolicy.max_size.set(max_size) + path = logging_data.pop("path", ...) + if path is not ...: + await self.config.yaml.logging.file.path.set(path) + await self.config.schema_version.set(4) if database_entries: await self.api_interface.local_cache_api.lavalink.insert(database_entries) diff --git a/redbot/cogs/audio/manager.py b/redbot/cogs/audio/manager.py index 6def104be..d9fd08ecd 100644 --- a/redbot/cogs/audio/manager.py +++ b/redbot/cogs/audio/manager.py @@ -51,7 +51,7 @@ if TYPE_CHECKING: _ = Translator("Audio", pathlib.Path(__file__)) log = getLogger("red.Audio.manager") JAR_VERSION: Final[str] = "3.4.0" -JAR_BUILD: Final[int] = 1347 +JAR_BUILD: Final[int] = 1350 LAVALINK_DOWNLOAD_URL: Final[str] = ( "https://github.com/Cog-Creators/Lavalink-Jars/releases/download/" f"{JAR_VERSION}_{JAR_BUILD}/" diff --git a/redbot/cogs/audio/utils.py b/redbot/cogs/audio/utils.py index 1cf670348..42a591426 100644 --- a/redbot/cogs/audio/utils.py +++ b/redbot/cogs/audio/utils.py @@ -78,11 +78,11 @@ DEFAULT_LAVALINK_YAML = { "yaml__metrics__prometheus__endpoint": "/metrics", "yaml__sentry__dsn": "", "yaml__sentry__environment": "", - "yaml__logging__file__max_history": 15, - "yaml__logging__file__max_size": "10MB", - "yaml__logging__path": "./logs/", + "yaml__logging__file__path": "./logs/", "yaml__logging__level__root": "INFO", "yaml__logging__level__lavalink": "INFO", + "yaml__logging__logback__rollingpolicy__max_history": 15, + "yaml__logging__logback__rollingpolicy__max_size": "10MB", } DEFAULT_LAVALINK_SETTINGS = {