feat(xen-api#unsetField): replaced by setField(_, null)
This commit is contained in:
parent
705d069246
commit
8e8b1c009a
@ -737,15 +737,16 @@ export class Xapi extends EventEmitter {
|
||||
getKeys(entries).map(entry => {
|
||||
const value = entries[entry]
|
||||
if (value !== undefined) {
|
||||
return value === null
|
||||
? this.unsetFieldEntry(type, ref, field, entry)
|
||||
: this.setFieldEntry(type, ref, field, entry, value)
|
||||
return this.setFieldEntry(type, ref, field, entry, value)
|
||||
}
|
||||
})
|
||||
).then(noop)
|
||||
}
|
||||
|
||||
async setFieldEntry(type, ref, field, entry, value) {
|
||||
if (value === null) {
|
||||
return this.call(`${type}.remove_from_${field}`, ref, entry)
|
||||
}
|
||||
while (true) {
|
||||
try {
|
||||
await this.call(`${type}.add_to_${field}`, ref, entry, value)
|
||||
@ -755,14 +756,10 @@ export class Xapi extends EventEmitter {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
await this.unsetFieldEntry(type, ref, field, entry)
|
||||
await this.call(`${type}.remove_from_${field}`, ref, entry)
|
||||
}
|
||||
}
|
||||
|
||||
unsetFieldEntry(type, ref, field, entry) {
|
||||
return this.call(`${type}.remove_from_${field}`, ref, entry)
|
||||
}
|
||||
|
||||
watchTask(ref) {
|
||||
const watchers = this._taskWatchers
|
||||
if (watchers === undefined) {
|
||||
|
Loading…
Reference in New Issue
Block a user