Tweak default backup configs to account for bad clone in 4.2.x

This commit is contained in:
amcmanu3 2024-07-30 14:30:30 -04:00
parent 4a58759183
commit 9f7f588e85
3 changed files with 17 additions and 2 deletions

View File

@ -400,6 +400,8 @@ class HelpersManagement:
if "excluded_dirs" in conf:
dirs_to_exclude = ",".join(conf["excluded_dirs"])
conf["excluded_dirs"] = dirs_to_exclude
if len(self.get_backups_by_server(conf["server_id"], True)) <= 0:
conf["default"] = True
backup = Backups.create(**conf)
logger.debug("Creating new backup record.")
return backup.backup_id

View File

@ -1373,6 +1373,19 @@ class ServerInstance:
def threaded_jar_update(self):
server_users = PermissionsServers.get_server_user_list(self.server_id)
# check to make sure a backup config actually exists before starting the update
if len(self.management_helper.get_backups_by_server(self.server_id, True)) <= 0:
for user in server_users:
WebSocketManager().broadcast_user(
user,
"notification",
"Backup config does not exist for "
+ self.name
+ ". canceling update.",
)
logger.error(f"Back config does not exist for {self.name}. Update Failed.")
self.stats_helper.set_update(False)
return False
was_started = "-1"
# Get default backup configuration
backup_config = HelpersManagement.get_default_server_backup(self.server_id)
@ -1428,6 +1441,7 @@ class ServerInstance:
"notification",
"Backup failed for " + self.name + ". canceling update.",
)
self.stats_helper.set_update(False)
return False
# lets download the files

View File

@ -58,8 +58,7 @@
<div class="card-body">
{% if len(data['backups']) == 0 %}
<div style="text-align: center; color: grey;">
<h7>{{ translate('serverBackups', 'no-backup', data['lang']) }} <strong>{{
translate('serverBackups', 'newBackup',data['lang']) }}</strong>.</h7>
<h7>{{ translate('serverBackups', 'no-backup', data['lang']) }}.</h7>
</div>
{% end %}
{% if len(data['backups']) > 0 %}