Skip to content

Commit fa388e3

Browse files
Sleepwalker86LKuemmel
authored andcommitted
Remove deprecated normalization method for backup cloud max backups and streamline retrieval of max_backups in Nextcloud and Samba modules. This change ensures consistent handling of max_backups directly from the configuration object.
1 parent a5b7c58 commit fa388e3

File tree

3 files changed

+3
-31
lines changed

3 files changed

+3
-31
lines changed

packages/helpermodules/update_config.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -710,9 +710,6 @@ def update(self):
710710
try:
711711
# erst breaking changes auflösen, sonst sind alte Topics schon gelöscht
712712
self.__solve_breaking_changes()
713-
# Normalisiere neue Felder auch im normalen Update-Pfad, nicht nur in
714-
# upgrade_datastore_* (UI kann aktuell bei "Feld geleert" null übermitteln).
715-
self.__normalize_backup_cloud_max_backups()
716713
self.__remove_outdated_topics()
717714
self._remove_invalid_topics()
718715
self.__pub_missing_defaults()
@@ -813,31 +810,6 @@ def __solve_breaking_changes(self) -> None:
813810
pub_system_message(
814811
{}, "Fehler bei der Aktualisierung der Konfiguration des Brokers.", MessageType.ERROR)
815812

816-
def __normalize_backup_cloud_max_backups(self) -> None:
817-
"""
818-
Serverseitige Normalisierung für `configuration.max_backups` im
819-
normalen Update-Pfad.
820-
821-
Semantik:
822-
- `0` => automatische Löschung deaktiviert
823-
"""
824-
for topic, payload in list(self.all_received_topics.items()):
825-
if topic != "openWB/system/backup_cloud/config":
826-
continue
827-
828-
configuration_payload = decode_payload(payload)
829-
if not isinstance(configuration_payload, dict):
830-
continue
831-
832-
cloud_type = configuration_payload.get("type")
833-
if cloud_type not in ("nextcloud", "samba"):
834-
continue
835-
836-
configuration_payload.setdefault("configuration", {})
837-
if configuration_payload["configuration"].get("max_backups") is None:
838-
configuration_payload["configuration"]["max_backups"] = 0
839-
self.__update_topic(topic, configuration_payload)
840-
841813
def _loop_all_received_topics(self, callback) -> None:
842814
modified_topics = {}
843815
for topic, payload in self.all_received_topics.items():

packages/modules/backup_clouds/nextcloud/backup_cloud.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def _list_backups(config: NextcloudBackupCloudConfiguration,
4343
Listet alle vorhandenen Backupdateien, die zum gleichen OpenWB-Suffix gehören
4444
(Pattern-Match am Dateinamen) und gibt eine nach Dateinamen sortierte Liste zurück.
4545
"""
46-
max_backups = getattr(config, "max_backups", None)
46+
max_backups = config.max_backups
4747
if not max_backups or max_backups <= 0:
4848
return []
4949

@@ -105,7 +105,7 @@ def _enforce_retention(config: NextcloudBackupCloudConfiguration, backup_filenam
105105
gleichen OpenWB-Suffix (Pattern-Match) übrig bleiben. Sortierung erfolgt nach
106106
Dateinamen, es bleiben die letzten N erhalten.
107107
"""
108-
max_backups = getattr(config, "max_backups", None)
108+
max_backups = config.max_backups
109109
if not max_backups or max_backups <= 0:
110110
return
111111

packages/modules/backup_clouds/samba/backup_cloud.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def _enforce_retention(conn, config: SambaBackupCloudConfiguration, backup_filen
3535
".openwb-backup.gpg" enden (stabiler Filter; der Teil vor der Endung ist
3636
timestamps-/versionspezifisch und darf nicht zum Gruppieren verwendet werden).
3737
"""
38-
max_backups = getattr(config, "max_backups", None)
38+
max_backups = config.max_backups
3939
if not max_backups or max_backups <= 0:
4040
return
4141

0 commit comments

Comments
 (0)