1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

F OpenNebula/one#5422: Fix delete provider

This commit is contained in:
Sergio Betanzos 2021-07-15 13:38:36 +02:00
parent d0447e8423
commit bcea10bc7f
No known key found for this signature in database
GPG Key ID: E3E704F097737136
2 changed files with 5 additions and 6 deletions

View File

@ -330,8 +330,9 @@ const executeCommand = (command = '', resource = '', options = {}) => {
let rtn = { success: false, data: null }
const { cmd, rsc } = addPrependCommand(command, resource)
const execute = spawnSync(cmd, rsc, options)
if (execute) {
if (execute.stdout) {
if (execute.stdout && execute.status === 0) {
rtn = { success: true, data: execute.stdout.toString() }
} else if (execute.stderr && execute.stderr.length > 0) {
rtn = { success: false, data: execute.stderr.toString() }

View File

@ -261,11 +261,9 @@ const deleteProvider = (res = {}, next = defaultEmptyFunction, params = {}, user
const data = executedCommand.data || ''
try {
if (executedCommand && executedCommand.success) {
if (executedCommand.data.length === 0) {
res.locals.httpCode = httpResponse(ok)
} else {
res.locals.httpCode = httpResponse(internalServerError, '', executedCommand.data)
}
res.locals.httpCode = httpResponse(ok)
} else {
res.locals.httpCode = httpResponse(internalServerError, '', executedCommand.data)
}
next()
return