4 files changed
+15
-10
No files matched your search
@@ -11,3 +11,5 @@ dependency/
|
||||
\.nyc_output/
|
||||
|
||||
coverage/*
|
||||
|
||||
\.vscode/
|
||||
@@ -1,5 +1,6 @@
|
||||
const beautify = require("json-beautify");
|
||||
const beautify = require("json-beautify")
|
||||
const { logger } = require('../logs/logger')
|
||||
const util = require('util')
|
||||
|
||||
exports.newCopySimulator = function newCopySimulator(pStorage) {
|
||||
|
||||
@@ -89,7 +90,7 @@ exports.newCopySimulator = function newCopySimulator(pStorage) {
|
||||
|
||||
// Delete simulator code
|
||||
let newSimulatorName = "simulator-" + pBotCodeName + "-Indicator-Bot"
|
||||
let newSimulatorPath = pTeamCodeName + "/bots/" + newSimulatorName
|
||||
let newSimulatorPath = "bots/" + newSimulatorName
|
||||
await deleteBlob(pTeamCodeName, newSimulatorPath, "Commons.js")
|
||||
await deleteBlob(pTeamCodeName, newSimulatorPath, "this.bot.config.json")
|
||||
await deleteBlob(pTeamCodeName, newSimulatorPath + "/Multi-Period-Daily", "User.Bot.js")
|
||||
@@ -131,13 +132,14 @@ exports.newCopySimulator = function newCopySimulator(pStorage) {
|
||||
})
|
||||
|
||||
let writeData = util.promisify(storage.writeData)
|
||||
await writeData(teamName, containerName, blobName, content)
|
||||
let response = await writeData(teamName, containerName, blobName, content)
|
||||
return response
|
||||
}
|
||||
|
||||
async function deleteBlob(teamName, containerName, blobName) {
|
||||
try {
|
||||
storage.deleteBlob[util.promisify.custom] = n => new Promise((resolve, reject) => {
|
||||
storage.deleteBlob(pOrg, pPath, pFile, (err, value) => {
|
||||
storage.deleteBlob(teamName, containerName, blobName, (err, value) => {
|
||||
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
|
||||
reject(err)
|
||||
} else {
|
||||
@@ -147,7 +149,8 @@ exports.newCopySimulator = function newCopySimulator(pStorage) {
|
||||
})
|
||||
|
||||
let deleteBlob = util.promisify(storage.deleteBlob)
|
||||
await deleteBlob(teamName, containerName, blobName)
|
||||
let response = await deleteBlob()
|
||||
return response
|
||||
} catch (err) {
|
||||
logger.warn('Error deleting the file: %s%s', containerName, blobName)
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@
|
||||
}
|
||||
|
||||
const newCopySimulator = require("./CopySimulator")
|
||||
let copySimulator = newCopySimulator.newCopySimulator()
|
||||
let copySimulator = newCopySimulator.newCopySimulator(storage)
|
||||
await copySimulator.copySimulator(pTeamCodeName, pBotCodeName, pBotDisplayName)
|
||||
|
||||
forkAACloud();
|
||||
@@ -885,7 +885,7 @@
|
||||
}
|
||||
|
||||
const newCopySimulator = require("./CopySimulator")
|
||||
let copySimulator = newCopySimulator.newCopySimulator()
|
||||
let copySimulator = newCopySimulator.newCopySimulator(storage)
|
||||
await copySimulator.removeSimulator(pTeamCodeName, pBotCodeName)
|
||||
|
||||
deleteAACloud();
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
|
||||
if (err) {
|
||||
onFileReceived(err, null, "Error retrieving file " + textFilename + " from bucket " + bucketName);
|
||||
return
|
||||
return
|
||||
}
|
||||
dataStream.on('data', function (chunk) {
|
||||
data += chunk
|
||||
@@ -319,7 +319,7 @@
|
||||
|
||||
/* ContainerAlreadyExists check */
|
||||
|
||||
if (JSON.stringify(err).indexOf("ContainerNotFound") > 0) {
|
||||
if (err.code === "NoSuchBucket") {
|
||||
|
||||
let err = {
|
||||
resutl: global.CUSTOM_FAIL_RESPONSE.result,
|
||||
@@ -348,4 +348,4 @@
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user