1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

F #5422: Add persistent flag in saveas (#1580)

This commit is contained in:
Jorge Miguel Lobo Escalona 2021-11-17 16:50:38 +01:00 committed by GitHub
parent b52c3251f5
commit 4463493b12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View File

@ -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, '')
}

View File

@ -30,6 +30,10 @@ const routes = {
name: {
from: fromData.postBody,
name: 'name'
},
persistent: {
from: fromData.postBody,
name: 'persistent'
}
}
}