Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions redisinsight/api/src/modules/browser/keys/keys.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export class KeysService {
} catch (error) {
this.logger.error(
`Failed to get keys with details info. ${error.message}.`,
error,
clientMetadata,
);
if (
Expand Down Expand Up @@ -129,6 +130,7 @@ export class KeysService {
} catch (error) {
this.logger.error(
`Failed to get keys info: ${error.message}.`,
error,
clientMetadata,
);
throw catchAclError(error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,120 +58,120 @@

async iteration(sessionMetadata: SessionMetadata): Promise<Database> {
let freeSubscription: CloudSubscription;
try {
this.logger.debug('Create free database');

this.checkSignal();

this.changeState({ step: CloudJobStep.Database });

this.logger.debug('Getting subscription metadata');

freeSubscription =
await this.dependencies.cloudSubscriptionCapiService.getSubscription(
this.options.capiCredentials,
this.data.subscriptionId,
CloudSubscriptionType.Fixed,
);
let cloudDatabase: CloudDatabase;

let createFreeDatabaseTask =
await this.dependencies.cloudDatabaseCapiService.createFreeDatabase(
this.options.capiCredentials,
{
subscriptionId: freeSubscription.id,
subscriptionType: freeSubscription.type,
},
);

this.checkSignal();

createFreeDatabaseTask = await this.runChildJob(
sessionMetadata,
WaitForTaskCloudJob,
{
taskId: createFreeDatabaseTask.taskId,
},
this.options,
);

const freeDatabaseId = createFreeDatabaseTask?.response?.resourceId;

if (!freeDatabaseId) {
throw new CloudTaskNoResourceIdException();
}

cloudDatabase = {
databaseId: freeDatabaseId,
} as CloudDatabase;

if (!cloudDatabase) {
throw new CloudJobUnexpectedErrorException(
'Unable to create free cloud database',
);
}

this.checkSignal();

cloudDatabase = await this.runChildJob(
sessionMetadata,
WaitForActiveDatabaseCloudJob,
{
databaseId: cloudDatabase.databaseId,
subscriptionId: this.data.subscriptionId,
subscriptionType: CloudSubscriptionType.Fixed,
},
this.options,
);

this.checkSignal();

const isDatabaseManagementEnabled =
await this.dependencies.featureService.isFeatureEnabled(
sessionMetadata,
KnownFeatures.DatabaseManagement,
);

if (!isDatabaseManagementEnabled) {
throw new CloudDatabaseImportForbiddenException();
}

const { publicEndpoint, name, password } = cloudDatabase;

const [host, port] = publicEndpoint.split(':');

const database = await this.dependencies.databaseService.create(
this.options.sessionMetadata,
{
host,
port: parseInt(port, 10),
name,
nameFromProvider: name,
password,
provider: HostingProvider.RE_CLOUD,
cloudDetails: {
...cloudDatabase?.cloudDetails,
free: true,
},
timeout: cloudConfig.cloudDatabaseConnectionTimeout,
},
);

try {
const clientMetadata = {
databaseId: database.id,
sessionMetadata: this.options.sessionMetadata,
context: ClientContext.Common,
db: database.db,
};
const dbSize =
await this.dependencies.databaseInfoService.getDBSize(clientMetadata);

if (dbSize === 0) {
this.dependencies.bulkImportService.importDefaultData(clientMetadata);
}
} catch (e) {
this.logger.error('Error when trying to feed the db with default data');
this.logger.error('Error when trying to feed the db with default data', e);

Check warning on line 174 in redisinsight/api/src/modules/cloud/job/jobs/create-free-database.cloud-job.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
}

Check warning on line 175 in redisinsight/api/src/modules/cloud/job/jobs/create-free-database.cloud-job.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

this.result = {
Expand Down
3 changes: 2 additions & 1 deletion redisinsight/api/src/modules/rdi/rdi.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class RdiService {
} catch (error) {
this.logger.error(
`Failed to delete instance(s): ${ids}`,
error.message,
error,
sessionMetadata,
);
this.analytics.sendRdiInstanceDeleted(
Expand All @@ -153,6 +153,7 @@ export class RdiService {
} catch (error) {
this.logger.error(
`Failed to connect to rdi instance ${rdiClientMetadata.id}`,
error,
rdiClientMetadata,
);
throw wrapRdiPipelineError(error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
return `${isEncryptionAvailable}`;
}
} catch (e) {
this.logger.error(`Unable to proceed agreements checker ${checker}`);
this.logger.error(`Unable to proceed agreements checker ${checker}`, e);

Check warning on line 212 in redisinsight/api/src/modules/settings/settings.service.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
}

return defaultOption;
Expand Down
Loading