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

F #3951: Remove provider yaml (#802)

Co-authored-by: Jorge Lobo <jlobo@opennebula.systems>
This commit is contained in:
Jorge Miguel Lobo Escalona 2021-02-12 13:47:57 +01:00 committed by GitHub
parent 1d51724851
commit 832a387873
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -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
}

View File

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