Merge pull request #257 from vatesfr/julien-f-remove-unnecessary-await
Remove unnecessary `await`s.
This commit is contained in:
commit
2d791571d5
@ -1,5 +1,5 @@
|
|||||||
export async function get () {
|
export async function get () {
|
||||||
return await this.getAllAcls()
|
return /* await */ this.getAllAcls()
|
||||||
}
|
}
|
||||||
|
|
||||||
get.permission = 'admin'
|
get.permission = 'admin'
|
||||||
@ -9,7 +9,7 @@ get.description = 'get existing ACLs'
|
|||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
|
||||||
export async function getCurrentPermissions () {
|
export async function getCurrentPermissions () {
|
||||||
return await this.getPermissionsForUser(this.session.get('user_id'))
|
return /* await */ this.getPermissionsForUser(this.session.get('user_id'))
|
||||||
}
|
}
|
||||||
|
|
||||||
getCurrentPermissions.permission = ''
|
getCurrentPermissions.permission = ''
|
||||||
|
@ -27,7 +27,7 @@ delete_.params = {
|
|||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
|
||||||
export async function getAll () {
|
export async function getAll () {
|
||||||
return await this.getAllGroups()
|
return /* await */ this.getAllGroups()
|
||||||
}
|
}
|
||||||
|
|
||||||
getAll.description = 'returns all the existing group'
|
getAll.description = 'returns all the existing group'
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
// FIXME so far, no acls for jobs
|
// FIXME so far, no acls for jobs
|
||||||
|
|
||||||
export async function getAll () {
|
export async function getAll () {
|
||||||
return await this.getAllJobs()
|
return /* await */ this.getAllJobs()
|
||||||
}
|
}
|
||||||
|
|
||||||
getAll.permission = 'admin'
|
getAll.permission = 'admin'
|
||||||
getAll.description = 'Gets all available jobs'
|
getAll.description = 'Gets all available jobs'
|
||||||
|
|
||||||
export async function get (id) {
|
export async function get (id) {
|
||||||
return await this.getJob(id)
|
return /* await */ this.getJob(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
get.permission = 'admin'
|
get.permission = 'admin'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
export async function get () {
|
export async function get () {
|
||||||
return await this.getPlugins()
|
return /* await */ this.getPlugins()
|
||||||
}
|
}
|
||||||
|
|
||||||
get.description = 'returns a list of all installed plugins'
|
get.description = 'returns a list of all installed plugins'
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
export async function getAll () {
|
export async function getAll () {
|
||||||
return await this.getAllRemotes()
|
return /* await */ this.getAllRemotes()
|
||||||
}
|
}
|
||||||
|
|
||||||
getAll.permission = 'admin'
|
getAll.permission = 'admin'
|
||||||
getAll.description = 'Gets all existing fs remote points'
|
getAll.description = 'Gets all existing fs remote points'
|
||||||
|
|
||||||
export async function get ({id}) {
|
export async function get ({id}) {
|
||||||
return await this.getRemote(id)
|
return /* await */ this.getRemote(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
get.permission = 'admin'
|
get.permission = 'admin'
|
||||||
@ -16,7 +16,7 @@ get.params = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function list ({id}) {
|
export async function list ({id}) {
|
||||||
return await this.listRemoteBackups(id)
|
return /* await */ this.listRemoteBackups(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
list.permission = 'admin'
|
list.permission = 'admin'
|
||||||
@ -26,7 +26,7 @@ list.params = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function create ({name, url}) {
|
export async function create ({name, url}) {
|
||||||
return await this.createRemote({name, url})
|
return /* await */ this.createRemote({name, url})
|
||||||
}
|
}
|
||||||
|
|
||||||
create.permission = 'admin'
|
create.permission = 'admin'
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
export async function getAll () {
|
export async function getAll () {
|
||||||
return await this.getRoles()
|
return /* await */ this.getRoles()
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
// FIXME so far, no acls for schedules
|
// FIXME so far, no acls for schedules
|
||||||
|
|
||||||
export async function getAll () {
|
export async function getAll () {
|
||||||
return await this.getAllSchedules()
|
return /* await */ this.getAllSchedules()
|
||||||
}
|
}
|
||||||
|
|
||||||
getAll.permission = 'admin'
|
getAll.permission = 'admin'
|
||||||
getAll.description = 'Gets all existing schedules'
|
getAll.description = 'Gets all existing schedules'
|
||||||
|
|
||||||
export async function get (id) {
|
export async function get (id) {
|
||||||
return await this.getSchedule(id)
|
return /* await */ this.getSchedule(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
get.permission = 'admin'
|
get.permission = 'admin'
|
||||||
@ -18,7 +18,7 @@ get.params = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function create ({jobId, cron, enabled, name}) {
|
export async function create ({jobId, cron, enabled, name}) {
|
||||||
return await this.createSchedule(this.session.get('user_id'), {job: jobId, cron, enabled, name})
|
return /* await */ this.createSchedule(this.session.get('user_id'), {job: jobId, cron, enabled, name})
|
||||||
}
|
}
|
||||||
|
|
||||||
create.permission = 'admin'
|
create.permission = 'admin'
|
||||||
|
@ -84,7 +84,7 @@ export default class Collection extends EventEmitter {
|
|||||||
: {}
|
: {}
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this._get(properties)
|
return /* await */ this._get(properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
async remove (ids) {
|
async remove (ids) {
|
||||||
|
@ -29,7 +29,7 @@ export class Groups extends Collection {
|
|||||||
// Serializes.
|
// Serializes.
|
||||||
group.users = JSON.stringify(group.users)
|
group.users = JSON.stringify(group.users)
|
||||||
|
|
||||||
return await this.update(group)
|
return /* await */ this.update(group)
|
||||||
}
|
}
|
||||||
|
|
||||||
async get (properties) {
|
async get (properties) {
|
||||||
|
@ -19,13 +19,13 @@ export class Jobs extends Collection {
|
|||||||
job.userId = userId
|
job.userId = userId
|
||||||
// Serializes.
|
// Serializes.
|
||||||
job.paramsVector = JSON.stringify(job.paramsVector)
|
job.paramsVector = JSON.stringify(job.paramsVector)
|
||||||
return await this.add(new Job(job))
|
return /* await */ this.add(new Job(job))
|
||||||
}
|
}
|
||||||
|
|
||||||
async save (job) {
|
async save (job) {
|
||||||
// Serializes.
|
// Serializes.
|
||||||
job.paramsVector = JSON.stringify(job.paramsVector)
|
job.paramsVector = JSON.stringify(job.paramsVector)
|
||||||
return await this.update(job)
|
return /* await */ this.update(job)
|
||||||
}
|
}
|
||||||
|
|
||||||
async get (properties) {
|
async get (properties) {
|
||||||
|
@ -18,7 +18,7 @@ export class PluginsMetadata extends Collection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async save ({ id, autoload, configuration }) {
|
async save ({ id, autoload, configuration }) {
|
||||||
return await this.update({
|
return /* await */ this.update({
|
||||||
id,
|
id,
|
||||||
autoload: autoload ? 'true' : 'false',
|
autoload: autoload ? 'true' : 'false',
|
||||||
configuration: configuration && JSON.stringify(configuration)
|
configuration: configuration && JSON.stringify(configuration)
|
||||||
@ -31,7 +31,7 @@ export class PluginsMetadata extends Collection {
|
|||||||
throw new Error('no such plugin metadata')
|
throw new Error('no such plugin metadata')
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.save({
|
return /* await */ this.save({
|
||||||
...pluginMetadata.properties,
|
...pluginMetadata.properties,
|
||||||
...data
|
...data
|
||||||
})
|
})
|
||||||
|
@ -27,7 +27,7 @@ export class Remotes extends Collection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async save (remote) {
|
async save (remote) {
|
||||||
return await this.update(remote)
|
return /* await */ this.update(remote)
|
||||||
}
|
}
|
||||||
|
|
||||||
async get (properties) {
|
async get (properties) {
|
||||||
|
@ -26,7 +26,7 @@ export class Schedules extends Collection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async save (schedule) {
|
async save (schedule) {
|
||||||
return await this.update(schedule)
|
return /* await */ this.update(schedule)
|
||||||
}
|
}
|
||||||
|
|
||||||
async get (properties) {
|
async get (properties) {
|
||||||
|
@ -17,6 +17,6 @@ export class Servers extends Collection {
|
|||||||
throw new Error('server already exists')
|
throw new Error('server already exists')
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.add({host, username, password, readOnly})
|
return /* await */ this.add({host, username, password, readOnly})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,14 +30,14 @@ export class Users extends Collection {
|
|||||||
const user = new User(properties)
|
const user = new User(properties)
|
||||||
|
|
||||||
// Adds the user to the collection.
|
// Adds the user to the collection.
|
||||||
return await this.add(user)
|
return /* await */ this.add(user)
|
||||||
}
|
}
|
||||||
|
|
||||||
async save (user) {
|
async save (user) {
|
||||||
// Serializes.
|
// Serializes.
|
||||||
user.groups = JSON.stringify(user.groups)
|
user.groups = JSON.stringify(user.groups)
|
||||||
|
|
||||||
return await this.update(user)
|
return /* await */ this.update(user)
|
||||||
}
|
}
|
||||||
|
|
||||||
async get (properties) {
|
async get (properties) {
|
||||||
|
22
src/xapi.js
22
src/xapi.js
@ -677,7 +677,7 @@ export default class Xapi extends XapiBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async installPoolPatchOnHost (patchUuid, hostId) {
|
async installPoolPatchOnHost (patchUuid, hostId) {
|
||||||
return await this._installPoolPatchOnHost(
|
return /* await */ this._installPoolPatchOnHost(
|
||||||
patchUuid,
|
patchUuid,
|
||||||
this.getObject(hostId)
|
this.getObject(hostId)
|
||||||
)
|
)
|
||||||
@ -835,7 +835,7 @@ export default class Xapi extends XapiBase {
|
|||||||
}`)
|
}`)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return await this.call(
|
return /* await */ this.call(
|
||||||
'VM.copy',
|
'VM.copy',
|
||||||
snapshotRef || vm.$ref,
|
snapshotRef || vm.$ref,
|
||||||
nameLabel,
|
nameLabel,
|
||||||
@ -889,13 +889,13 @@ export default class Xapi extends XapiBase {
|
|||||||
: this._copyVm(vm, nameLabel)
|
: this._copyVm(vm, nameLabel)
|
||||||
)
|
)
|
||||||
|
|
||||||
return await this._getOrWaitObject(cloneRef)
|
return /* await */ this._getOrWaitObject(cloneRef)
|
||||||
}
|
}
|
||||||
|
|
||||||
async copyVm (vmId, srId, {
|
async copyVm (vmId, srId, {
|
||||||
nameLabel = undefined
|
nameLabel = undefined
|
||||||
} = {}) {
|
} = {}) {
|
||||||
return await this._getOrWaitObject(
|
return /* await */ this._getOrWaitObject(
|
||||||
await this._copyVm(
|
await this._copyVm(
|
||||||
this.getObject(vmId),
|
this.getObject(vmId),
|
||||||
nameLabel,
|
nameLabel,
|
||||||
@ -1230,7 +1230,7 @@ export default class Xapi extends XapiBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async deleteVm (vmId, deleteDisks = false) {
|
async deleteVm (vmId, deleteDisks = false) {
|
||||||
return await this._deleteVm(
|
return /* await */ this._deleteVm(
|
||||||
this.getObject(vmId),
|
this.getObject(vmId),
|
||||||
deleteDisks
|
deleteDisks
|
||||||
)
|
)
|
||||||
@ -1632,7 +1632,7 @@ export default class Xapi extends XapiBase {
|
|||||||
onlyMetadata = false,
|
onlyMetadata = false,
|
||||||
srId
|
srId
|
||||||
} = {}) {
|
} = {}) {
|
||||||
return await this._getOrWaitObject(await this._importVm(
|
return /* await */ this._getOrWaitObject(await this._importVm(
|
||||||
stream,
|
stream,
|
||||||
srId && this.getObject(srId),
|
srId && this.getObject(srId),
|
||||||
onlyMetadata
|
onlyMetadata
|
||||||
@ -1680,7 +1680,7 @@ export default class Xapi extends XapiBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async snapshotVm (vmId, nameLabel = undefined) {
|
async snapshotVm (vmId, nameLabel = undefined) {
|
||||||
return await this._getOrWaitObject(
|
return /* await */ this._getOrWaitObject(
|
||||||
await this._snapshotVm(
|
await this._snapshotVm(
|
||||||
this.getObject(vmId),
|
this.getObject(vmId),
|
||||||
nameLabel
|
nameLabel
|
||||||
@ -1896,7 +1896,7 @@ export default class Xapi extends XapiBase {
|
|||||||
data.xenstore_data = xenstore_data
|
data.xenstore_data = xenstore_data
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.call('VDI.create', data)
|
return /* await */ this.call('VDI.create', data)
|
||||||
}
|
}
|
||||||
|
|
||||||
async moveVdi (vdiId, srId) {
|
async moveVdi (vdiId, srId) {
|
||||||
@ -2030,7 +2030,7 @@ export default class Xapi extends XapiBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async createVdi (size, opts) {
|
async createVdi (size, opts) {
|
||||||
return await this._getOrWaitObject(
|
return /* await */ this._getOrWaitObject(
|
||||||
await this._createVdi(size, opts)
|
await this._createVdi(size, opts)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -2206,7 +2206,7 @@ export default class Xapi extends XapiBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async createVif (vmId, networkId, opts = undefined) {
|
async createVif (vmId, networkId, opts = undefined) {
|
||||||
return await this._getOrWaitObject(
|
return /* await */ this._getOrWaitObject(
|
||||||
await this._createVif(
|
await this._createVif(
|
||||||
this.getObject(vmId),
|
this.getObject(vmId),
|
||||||
this.getObject(networkId),
|
this.getObject(networkId),
|
||||||
@ -2225,7 +2225,7 @@ export default class Xapi extends XapiBase {
|
|||||||
const vm = this.getObject(vmId)
|
const vm = this.getObject(vmId)
|
||||||
const host = vm.$resident_on || this.pool.$master
|
const host = vm.$resident_on || this.pool.$master
|
||||||
|
|
||||||
return await this.call('host.call_plugin', host.$ref, 'xscontainer', action, {
|
return /* await */ this.call('host.call_plugin', host.$ref, 'xscontainer', action, {
|
||||||
vmuuid: vm.uuid,
|
vmuuid: vm.uuid,
|
||||||
container: containerId
|
container: containerId
|
||||||
})
|
})
|
||||||
|
@ -180,7 +180,7 @@ export default class {
|
|||||||
const getPath = (file, dir) => dir ? `${dir}/${file}` : file
|
const getPath = (file, dir) => dir ? `${dir}/${file}` : file
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
mapToArray(backups.slice(0, n), async backup => await handler.unlink(getPath(backup, dir)))
|
mapToArray(backups.slice(0, n), async backup => /* await */ handler.unlink(getPath(backup, dir)))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,7 +214,7 @@ export default class {
|
|||||||
// Import vm metadata.
|
// Import vm metadata.
|
||||||
const vm = await (async () => {
|
const vm = await (async () => {
|
||||||
const stream = await handler.createReadStream(`${filePath}.xva`)
|
const stream = await handler.createReadStream(`${filePath}.xva`)
|
||||||
return await xapi.importVm(stream, { onlyMetadata: true })
|
return /* await */ xapi.importVm(stream, { onlyMetadata: true })
|
||||||
})()
|
})()
|
||||||
|
|
||||||
const vmName = vm.name_label
|
const vmName = vm.name_label
|
||||||
@ -431,7 +431,7 @@ export default class {
|
|||||||
|
|
||||||
async _listDeltaVmBackups (handler, dir) {
|
async _listDeltaVmBackups (handler, dir) {
|
||||||
const files = await handler.list(dir)
|
const files = await handler.list(dir)
|
||||||
return await sortBy(filter(files, isDeltaBackup))
|
return /* await */ sortBy(filter(files, isDeltaBackup))
|
||||||
}
|
}
|
||||||
|
|
||||||
async _failedRollingDeltaVmBackup (xapi, handler, dir, fulFilledVdiBackups) {
|
async _failedRollingDeltaVmBackup (xapi, handler, dir, fulFilledVdiBackups) {
|
||||||
|
@ -26,7 +26,7 @@ export default class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getAllJobs () {
|
async getAllJobs () {
|
||||||
return await this._jobs.get()
|
return /* await */ this._jobs.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
async getJob (id) {
|
async getJob (id) {
|
||||||
@ -45,11 +45,11 @@ export default class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async updateJob (job) {
|
async updateJob (job) {
|
||||||
return await this._jobs.save(job)
|
return /* await */ this._jobs.save(job)
|
||||||
}
|
}
|
||||||
|
|
||||||
async removeJob (id) {
|
async removeJob (id) {
|
||||||
return await this._jobs.remove(id)
|
return /* await */ this._jobs.remove(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
async runJobSequence (idSequence) {
|
async runJobSequence (idSequence) {
|
||||||
|
@ -122,7 +122,7 @@ export default class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getPlugins () {
|
async getPlugins () {
|
||||||
return await Promise.all(
|
return /* await */ Promise.all(
|
||||||
mapToArray(this._plugins, ({ id }) => this._getPlugin(id))
|
mapToArray(this._plugins, ({ id }) => this._getPlugin(id))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ export default class {
|
|||||||
|
|
||||||
async createRemote ({name, url}) {
|
async createRemote ({name, url}) {
|
||||||
let remote = await this._remotes.create(name, url)
|
let remote = await this._remotes.create(name, url)
|
||||||
return await this.updateRemote(remote.get('id'), {enabled: true})
|
return /* await */ this.updateRemote(remote.get('id'), {enabled: true})
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateRemote (id, {name, url, enabled, error}) {
|
async updateRemote (id, {name, url, enabled, error}) {
|
||||||
|
@ -134,7 +134,7 @@ export default class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getAllSchedules () {
|
async getAllSchedules () {
|
||||||
return await this._redisSchedules.get()
|
return /* await */ this._redisSchedules.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
async createSchedule (userId, {job, cron, enabled, name}) {
|
async createSchedule (userId, {job, cron, enabled, name}) {
|
||||||
|
@ -184,7 +184,7 @@ export default class {
|
|||||||
throw new Error(`registering ${name} user is forbidden`)
|
throw new Error(`registering ${name} user is forbidden`)
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.createUser(name, {
|
return /* await */ this.createUser(name, {
|
||||||
_provider: provider
|
_provider: provider
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user