mirror of
https://github.com/OpenNebula/one.git
synced 2026-12-04 22:21:36 +09:00
(cherry picked from commit 4463493b12)
This commit is contained in:
1 parent
5f29eb1487
commit
e1f6eb95b0
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