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: if "excluded_dirs" in conf:
dirs_to_exclude = ",".join(conf["excluded_dirs"]) dirs_to_exclude = ",".join(conf["excluded_dirs"])
conf["excluded_dirs"] = dirs_to_exclude 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) backup = Backups.create(**conf)
logger.debug("Creating new backup record.") logger.debug("Creating new backup record.")
return backup.backup_id return backup.backup_id

View File

@ -1373,6 +1373,19 @@ class ServerInstance:
def threaded_jar_update(self): def threaded_jar_update(self):
server_users = PermissionsServers.get_server_user_list(self.server_id) 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" was_started = "-1"
# Get default backup configuration # Get default backup configuration
backup_config = HelpersManagement.get_default_server_backup(self.server_id) backup_config = HelpersManagement.get_default_server_backup(self.server_id)
@ -1428,6 +1441,7 @@ class ServerInstance:
"notification", "notification",
"Backup failed for " + self.name + ". canceling update.", "Backup failed for " + self.name + ". canceling update.",
) )
self.stats_helper.set_update(False)
return False return False
# lets download the files # lets download the files

View File

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