Fixing simulator copy

This commit is contained in:
Matias committed 2019-04-10 14:59:21 +02:00
1 parent b7a30dc476
commit 619f49c50f
2 files changed
+22 -34

No files matched your search

+4 -16
View File
@@ -70,7 +70,7 @@ exports.newCopySimulator = function newCopySimulator(pStorage) {
// Write the new files
let newSimulatorName = "simulator-" + pBotCodeName + "-Indicator-Bot"
let newSimulatorPath = "/bots/" + newSimulatorName
let newSimulatorPath = "bots/" + newSimulatorName
await writeFileContent(pTeamCodeName, newSimulatorPath, "Commons.js", commons)
await writeFileContent(pTeamCodeName, newSimulatorPath, "this.bot.config.json", beautify(parsedConfig, null, 2, 80))
await writeFileContent(pTeamCodeName, newSimulatorPath + "/Multi-Period-Daily", "User.Bot.js", codeDaily)
@@ -107,11 +107,7 @@ exports.newCopySimulator = function newCopySimulator(pStorage) {
async function getFileContent(containerName, blobName) {
storage.readData[util.promisify.custom] = n => new Promise((resolve, reject) => {
storage.readData("AATemplate", containerName, blobName, false, (err, pFileContent) => {
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
reject(err)
} else {
resolve(pFileContent)
}
resolve(pFileContent)
})
})
@@ -123,11 +119,7 @@ exports.newCopySimulator = function newCopySimulator(pStorage) {
async function writeFileContent(teamName, containerName, blobName, content) {
storage.writeData[util.promisify.custom] = n => new Promise((resolve, reject) => {
storage.writeData(teamName, containerName, blobName, content, (err, value) => {
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
reject(err)
} else {
resolve()
}
resolve()
})
})
@@ -140,11 +132,7 @@ exports.newCopySimulator = function newCopySimulator(pStorage) {
try {
storage.deleteBlob[util.promisify.custom] = n => new Promise((resolve, reject) => {
storage.deleteBlob(teamName, containerName, blobName, (err, value) => {
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
reject(err)
} else {
resolve()
}
resolve()
})
})
+18 -18
View File
@@ -3,8 +3,8 @@
let thisObject = {
readData: readData,
writeData: writeData,
createContainer: createContainer,
deleteContainer: deleteContainer,
createContainer: createContainer,
deleteContainer: deleteContainer,
deleteBlob: deleteBlob,
initialize: initialize
}
@@ -21,7 +21,7 @@
storageData = pStorageData;
serverConfig = pServerConfig;
minioClient = new Minio.Client({
endPoint: process.env.MINIO_END_POINT,
port: JSON.parse(process.env.MINIO_PORT),
@@ -29,7 +29,7 @@
accessKey: process.env.MINIO_ACCESS_KEY,
secretKey: process.env.MINIO_SECRET_KEY
})
}
function readData(pOrg, pPath, pFile, saveAtCache, callBackFunction) {
@@ -125,7 +125,7 @@
storageData.set(pOrg + '.' + pPath + '.' + pFile, text);
}
if (err !== null || text === null) {
if (CONSOLE_ERROR_LOG === true) { console.log("[ERROR] Storage -> readData -> onFileReceived -> Error Received from Storage Library. "); }
@@ -139,19 +139,19 @@
/* TEMPORARY CODE TO UPDATE THE MINIO SERVER DURING TRANSITION. */
try {
// try {
minioClient.putObject(bucketName, textFilename, text, 'text/plain', function (err) {
if (err) {
console.log("ERROR AT MINIO SERVER PUTTING OBJECT : " + err);
return;
}
console.log(textFilename + ' Successfully uploaded ' + textFilename + ' the MINIO SERVER');
})
} catch (err) {
console.log("ERROR UPDATING MINIO SERVER : " + err);
}
// minioClient.putObject(bucketName, textFilename, text, 'text/plain', function (err) {
// if (err) {
// console.log("ERROR AT MINIO SERVER PUTTING OBJECT : " + err);
// return;
// }
// console.log(textFilename + ' Successfully uploaded ' + textFilename + ' the MINIO SERVER');
// })
// } catch (err) {
// console.log("ERROR UPDATING MINIO SERVER : " + err);
// }
callBackFunction(global.DEFAULT_OK_RESPONSE, text);
@@ -445,4 +445,4 @@
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
}
}