Compare commits

..

6 Commits

Author SHA1 Message Date
wescoeur
de6ef49043 0.2.0 2015-12-03 15:43:35 +01:00
wescoeur
28bf7ee90b Update schema with titles/descriptions on mails/xmpp attributes. 2015-12-02 15:47:33 +01:00
wescoeur
4d1ca7ede4 Merge remote-tracking branch 'refs/remotes/origin/master' 2015-12-02 15:42:27 +01:00
wescoeur
f3b46515c5 Update for Xmpp support 2015-12-02 15:40:40 +01:00
Julien Fontanet
c059a416f7 0.1.1 2015-12-01 15:54:42 +01:00
Olivier Lambert
099db6792a Update the documentatioh 2015-11-30 18:58:56 +01:00
3 changed files with 38 additions and 17 deletions

View File

@@ -6,10 +6,10 @@ XO-Server plugin which sends email reports when backup jobs are done.
## Install
Installation of the [npm package](https://npmjs.org/package/xo-server-backup-reports):
Go inside your `xo-server` folder and install it:
```
> npm install --global xo-server-backup-reports
> npm install xo-server-backup-reports
```
## Usage
@@ -24,11 +24,6 @@ You must have the [xo-server-transport-email](https://github.com/vatesfr/xo-serv
plugins:
xo-server-backup-reports:
# Receivers of notifications
to:
# Define your receivers here using brackets like this:
# [email1, email2, ...]
```
## Development

View File

@@ -1,6 +1,6 @@
{
"name": "xo-server-backup-reports",
"version": "0.1.0",
"version": "0.2.0",
"license": "AGPL-3.0",
"description": "Backup reports plugin for XO-Server",
"keywords": [

View File

@@ -3,10 +3,23 @@ import moment from 'moment'
export const configurationSchema = {
type: 'object',
description: 'an array of emails (receivers)',
properties: {
to: {
toMails: {
type: 'array',
title: 'mails',
description: 'an array of recipients (mails)',
items: {
type: 'string'
},
minItems: 1
},
toXmpp: {
type: 'array',
title: 'xmpp address',
description: 'an array of recipients (xmpp)',
items: {
type: 'string'
},
@@ -23,8 +36,9 @@ class BackupReportsXoPlugin {
this._report = ::this._wrapper
}
configure ({to}) {
this._receivers = to
configure ({ toMails, toXmpp }) {
this._mailsReceivers = toMails
this._xmppReceivers = toXmpp
}
load () {
@@ -108,12 +122,24 @@ class BackupReportsXoPlugin {
` - Failed backed up VM: ${nCalls - nSuccess}`
].join('\n'))
const markdown = text.join('\n')
// TODO : Handle errors when `sendEmail` isn't present. (Plugin dependencies)
await this._xo.sendEmail({
to: this._receivers,
subject: 'Backup Reports (XenOrchestra)',
markdown: text.join('\n')
})
if (this._xo.sendEmail) {
await this._xo.sendEmail({
to: this._mailsReceivers,
subject: 'Backup Reports (XenOrchestra)',
markdown
})
}
if (this._xo.sendToXmppClient) {
this._xo.sendToXmppClient({
to: this._xmppReceivers,
message: markdown
})
}
}
}