return success state of the backup from wings

This commit is contained in:
Dane Everitt 2020-08-20 21:28:06 -07:00
parent 43d8bd656a
commit 138080d5e2
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53

View File

@ -94,6 +94,13 @@ func (s *Server) Backup(b backup.BackupInterface) error {
}).Warn("failed to notify panel of failed backup state") }).Warn("failed to notify panel of failed backup state")
} }
s.Events().PublishJson(BackupCompletedEvent+":"+b.Identifier(), map[string]interface{}{
"uuid": b.Identifier(),
"is_successful": false,
"sha256_hash": "",
"file_size": 0,
})
return errors.WithStack(err) return errors.WithStack(err)
} }
@ -108,9 +115,10 @@ func (s *Server) Backup(b backup.BackupInterface) error {
// Emit an event over the socket so we can update the backup in realtime on // Emit an event over the socket so we can update the backup in realtime on
// the frontend for the server. // the frontend for the server.
s.Events().PublishJson(BackupCompletedEvent+":"+b.Identifier(), map[string]interface{}{ s.Events().PublishJson(BackupCompletedEvent+":"+b.Identifier(), map[string]interface{}{
"uuid": b.Identifier(), "uuid": b.Identifier(),
"sha256_hash": ad.Checksum, "is_successful": true,
"file_size": ad.Size, "sha256_hash": ad.Checksum,
"file_size": ad.Size,
}) })
return nil return nil