mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
Co-authored-by: Jorge Lobo <jlobo@opennebula.systems>
This commit is contained in:
parent
1d51724851
commit
832a387873
@ -173,7 +173,7 @@ const removeFile = (path = '') => {
|
||||
}
|
||||
}
|
||||
|
||||
const renameFolder = (path = '', name = '', type = 'replace') => {
|
||||
const renameFolder = (path = '', name = '', type = 'replace', callback) => {
|
||||
let rtn = false
|
||||
if (path) {
|
||||
let internalPath = path
|
||||
@ -194,6 +194,9 @@ const renameFolder = (path = '', name = '', type = 'replace') => {
|
||||
default:
|
||||
break
|
||||
}
|
||||
if (callback && typeof callback === 'function') {
|
||||
callback(path)
|
||||
}
|
||||
renameSync(internalPath, newPath)
|
||||
rtn = newPath
|
||||
}
|
||||
|
@ -509,8 +509,11 @@ const createProvision = (res = {}, next = () => undefined, params = {}, userData
|
||||
// This function is only executed if the command is completed
|
||||
const close = (success, lastLine) => {
|
||||
stream.end()
|
||||
const removeConfigFile = (file) => {
|
||||
removeFile(file)
|
||||
}
|
||||
if (success && regexp.test(lastLine)) {
|
||||
const newPath = renameFolder(config.path, lastLine.match('\\d+'))
|
||||
const newPath = renameFolder(config.path, lastLine.match('\\d+'), 'replace', removeConfigFile)
|
||||
if (newPath) {
|
||||
existsFile(
|
||||
relFileYML,
|
||||
@ -538,7 +541,7 @@ const createProvision = (res = {}, next = () => undefined, params = {}, userData
|
||||
}
|
||||
}
|
||||
if (success === false) {
|
||||
renameFolder(config.path, appendError, 'append')
|
||||
renameFolder(config.path, appendError, 'append', removeConfigFile)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user