Make sure we track restore/backlog success logs as well.

This commit is contained in:
Guo Xiang Tan
2016-08-03 16:18:35 +08:00
parent b860d1b254
commit adc8336949
4 changed files with 27 additions and 9 deletions

View File

@@ -260,9 +260,9 @@ module BackupRestore
def notify_user
log "Notifying '#{@user.username}' of the end of the backup..."
if @success
SystemMessage.create_from_system_user(@user, :backup_succeeded)
SystemMessage.create_from_system_user(@user, :backup_succeeded, logs: pretty_logs(@logs))
else
SystemMessage.create_from_system_user(@user, :backup_failed, logs: @logs.join("\n"))
SystemMessage.create_from_system_user(@user, :backup_failed, logs: pretty_logs(@logs))
end
end

View File

@@ -378,9 +378,9 @@ module BackupRestore
if user = User.find_by(email: @user_info[:email])
log "Notifying '#{user.username}' of the end of the restore..."
if @success
SystemMessage.create_from_system_user(user, :restore_succeeded)
SystemMessage.create_from_system_user(user, :restore_succeeded, logs: pretty_logs(@logs))
else
SystemMessage.create_from_system_user(user, :restore_failed, logs: @logs.join("\n"))
SystemMessage.create_from_system_user(user, :restore_failed, logs: pretty_logs(@logs))
end
else
log "Could not send notification to '#{@user_info[:username]}' (#{@user_info[:email]}), because the user does not exists..."

View File

@@ -10,5 +10,9 @@ module BackupRestore
output
end
def pretty_logs(logs)
logs.join("\n")
end
end
end