Files
xen-orchestra/@xen-orchestra/xapi/task.js
2022-03-23 09:48:07 +01:00

16 lines
390 B
JavaScript

'use strict'
const ignoreErrors = require('promise-toolbox/ignoreErrors')
module.exports = class Task {
create(name = 'untitled task', description) {
return this.createTask(`[XO] ${name}`, description)
}
destroy(ref) {
// pending task cannot be destroyed
ignoreErrors.call(this.call('task.set_status', ref, 'cancelled'))
return this.call('task.destroy', ref)
}
}