mirror of
https://github.com/OpenNebula/one.git
synced 2026-12-02 05:06:14 +09:00
1 parent
b52c3251f5
commit
4463493b12
2 files changed
+13
-3
No files matched your search
@@ -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'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user