mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
parent
b52c3251f5
commit
4463493b12
@ -43,13 +43,19 @@ const regexpSplitLine = /\r|\n/
|
||||
*/
|
||||
const saveAsTemplate = (res = {}, next = defaultEmptyFunction, params = {}, userData = {}) => {
|
||||
let rtn = httpBadRequest
|
||||
if (params && params.id && params.name) {
|
||||
const paramsCommand = ['save', `${params.id}`, `${params.name}`]
|
||||
const { id, name, persistent } = params
|
||||
if (id && name) {
|
||||
let message = ''
|
||||
const paramsCommand = ['save', `${id}`, `${name}`]
|
||||
|
||||
if (persistent && persistent === 'true') {
|
||||
paramsCommand.push('--persistent')
|
||||
}
|
||||
|
||||
const executedCommand = executeCommand(defaultCommandVM, paramsCommand, prependCommand)
|
||||
|
||||
const response = executedCommand.success ? ok : internalServerError
|
||||
let message = ''
|
||||
|
||||
if (executedCommand.data) {
|
||||
message = executedCommand.data.replace(regexpSplitLine, '')
|
||||
}
|
||||
|
@ -30,6 +30,10 @@ const routes = {
|
||||
name: {
|
||||
from: fromData.postBody,
|
||||
name: 'name'
|
||||
},
|
||||
persistent: {
|
||||
from: fromData.postBody,
|
||||
name: 'persistent'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user