fix(azuredeployer.gblib): Fix MSFT changes.

This commit is contained in:
Rodrigo Rodriguez 2021-11-29 18:39:42 -03:00
parent b017f32b04
commit 64d9884b69
6 changed files with 17 additions and 16 deletions

View file

@ -113,7 +113,7 @@ export class GBAdminService implements IGBAdminService {
maximumLength: 14
};
let password = passwordGenerator.generatePassword(options);
password = password.replace(/[\@\[\=\:\;\?\"\'\#]/gi, '1');
password = password.replace(/[\@\[\=\:\;\?\"\'\#]/gi, '*');
return password;
}

View file

@ -429,8 +429,6 @@ export class AzureDeployerService implements IGBInstallationDeployer {
const nlpa = await this.createNLPAuthoring(name, `${name}-nlpa`, instance.cloudLocation);
instance.nlpEndpoint = nlp.endpoint;
GBLog.info(`Waiting for Cognitive objects stack...`);
const sleep = ms => {
return new Promise(resolve => {
setTimeout(resolve, ms);
@ -449,7 +447,7 @@ export class AzureDeployerService implements IGBInstallationDeployer {
);
GBLog.info(`Waiting to finishing NLP service and keys creation...`);
GBLog.info(`Waiting one minute to finishing NLP service and keys creation...`);
await sleep(60000);
keys = await this.cognitiveClient.accounts.listKeys(name, textAnalytics.name);
instance.textAnalyticsKey = keys.key1;

View file

@ -198,16 +198,6 @@ export class GBDeployer implements IGBDeployer {
await this.deployAppPackages(list, core, appPackages);
GBLog.info(`App Package deployment done.`);
// Then all remaining general packages are loaded.
const instances = await core.loadInstances();
await CollectionUtil.asyncForEach(instances, async instance => {
this.mountGBKBAssets(`${instance.botId}.gbkb`,
instance.botId, `${instance.botId}.gbkb`);
});
GBLog.info(`Package deployment done.`);
}
/**
@ -821,7 +811,7 @@ export class GBDeployer implements IGBDeployer {
/**
* Servers bot storage assets to be used by web, WhatsApp and other channels.
*/
public mountGBKBAssets(packageName: any, botId: string, filename: string) {
public static mountGBKBAssets(packageName: any, botId: string, filename: string) {
// Servers menu assets.

View file

@ -165,6 +165,16 @@ export class GBMinService {
}
});
// Then all remaining general packages are loaded.
await CollectionUtil.asyncForEach(instances, async instance => {
GBDeployer.mountGBKBAssets(`${instance.botId}.gbkb`,
instance.botId, `${instance.botId}.gbkb`);
});
GBLog.info(`Package deployment done.`);
}

View file

@ -710,7 +710,7 @@ export class KBService implements IGBKBService {
GBLog.info(`[GBDeployer] Importing: ${localPath}`);
const p = await deployer.deployPackageToStorage(instance.instanceId, packageName);
await this.importKbPackage(min, localPath, p, instance);
deployer.mountGBKBAssets(packageName, min.botId, localPath);
GBDeployer.mountGBKBAssets(packageName, min.botId, localPath);
await deployer.rebuildIndex(instance, new AzureDeployerService(deployer).getKBSearchSchema(instance.searchIndex));
GBLog.info(`[GBDeployer] Finished import of ${localPath}`);

View file

@ -155,6 +155,7 @@ export class GBServer {
await deployer.deployPackages(core, server, GBServer.globals.appPackages);
await core.syncDatabaseStructure();
GBLog.info(`Publishing instances...`);
const instances: IGBInstance[] = await core.loadAllInstances(
core,
@ -173,6 +174,8 @@ export class GBServer {
await deployer.deployBotFull(instance, GBServer.globals.publicAddress);
instances.push(instance);
// Runs the search even with empty content to create structure.
await azureDeployer['runSearch'](instance);
}