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 => {
|
getKeys(entries).map(entry => {
|
||||||
const value = entries[entry]
|
const value = entries[entry]
|
||||||
if (value !== undefined) {
|
if (value !== undefined) {
|
||||||
return value === null
|
return this.setFieldEntry(type, ref, field, entry, value)
|
||||||
? this.unsetFieldEntry(type, ref, field, entry)
|
|
||||||
: this.setFieldEntry(type, ref, field, entry, value)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
).then(noop)
|
).then(noop)
|
||||||
}
|
}
|
||||||
|
|
||||||
async setFieldEntry(type, ref, field, entry, value) {
|
async setFieldEntry(type, ref, field, entry, value) {
|
||||||
|
if (value === null) {
|
||||||
|
return this.call(`${type}.remove_from_${field}`, ref, entry)
|
||||||
|
}
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
await this.call(`${type}.add_to_${field}`, ref, entry, value)
|
await this.call(`${type}.add_to_${field}`, ref, entry, value)
|
||||||
@ -755,14 +756,10 @@ export class Xapi extends EventEmitter {
|
|||||||
throw error
|
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) {
|
watchTask(ref) {
|
||||||
const watchers = this._taskWatchers
|
const watchers = this._taskWatchers
|
||||||
if (watchers === undefined) {
|
if (watchers === undefined) {
|
||||||
|
Loading…
Reference in New Issue
Block a user