mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-03 06:03:12 +00:00
Add Sync Option in OpenmetadataOperations (#17089)
This commit is contained in:
parent
c7710481b5
commit
8561022c70
@ -44,6 +44,8 @@ import org.openmetadata.schema.ServiceEntityInterface;
|
|||||||
import org.openmetadata.schema.entity.app.App;
|
import org.openmetadata.schema.entity.app.App;
|
||||||
import org.openmetadata.schema.entity.app.AppRunRecord;
|
import org.openmetadata.schema.entity.app.AppRunRecord;
|
||||||
import org.openmetadata.schema.entity.services.ingestionPipelines.IngestionPipeline;
|
import org.openmetadata.schema.entity.services.ingestionPipelines.IngestionPipeline;
|
||||||
|
import org.openmetadata.schema.settings.Settings;
|
||||||
|
import org.openmetadata.schema.settings.SettingsType;
|
||||||
import org.openmetadata.schema.system.EventPublisherJob;
|
import org.openmetadata.schema.system.EventPublisherJob;
|
||||||
import org.openmetadata.schema.type.Include;
|
import org.openmetadata.schema.type.Include;
|
||||||
import org.openmetadata.sdk.PipelineServiceClientInterface;
|
import org.openmetadata.sdk.PipelineServiceClientInterface;
|
||||||
@ -60,6 +62,7 @@ import org.openmetadata.service.jdbi3.EntityRepository;
|
|||||||
import org.openmetadata.service.jdbi3.IngestionPipelineRepository;
|
import org.openmetadata.service.jdbi3.IngestionPipelineRepository;
|
||||||
import org.openmetadata.service.jdbi3.ListFilter;
|
import org.openmetadata.service.jdbi3.ListFilter;
|
||||||
import org.openmetadata.service.jdbi3.MigrationDAO;
|
import org.openmetadata.service.jdbi3.MigrationDAO;
|
||||||
|
import org.openmetadata.service.jdbi3.SystemRepository;
|
||||||
import org.openmetadata.service.jdbi3.locator.ConnectionAwareAnnotationSqlLocator;
|
import org.openmetadata.service.jdbi3.locator.ConnectionAwareAnnotationSqlLocator;
|
||||||
import org.openmetadata.service.jdbi3.locator.ConnectionType;
|
import org.openmetadata.service.jdbi3.locator.ConnectionType;
|
||||||
import org.openmetadata.service.migration.api.MigrationWorkflow;
|
import org.openmetadata.service.migration.api.MigrationWorkflow;
|
||||||
@ -160,6 +163,26 @@ public class OpenMetadataOperations implements Callable<Integer> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Command(
|
||||||
|
name = "syncEmailFromEnv",
|
||||||
|
description = "Sync the email configuration from environment variables")
|
||||||
|
public Integer syncEmailFromEnv() {
|
||||||
|
try {
|
||||||
|
parseConfig();
|
||||||
|
Entity.setCollectionDAO(jdbi.onDemand(CollectionDAO.class));
|
||||||
|
SystemRepository systemRepository = new SystemRepository();
|
||||||
|
Settings updatedSettings =
|
||||||
|
new Settings()
|
||||||
|
.withConfigType(SettingsType.EMAIL_CONFIGURATION)
|
||||||
|
.withConfigValue(config.getSmtpSettings());
|
||||||
|
systemRepository.createOrUpdate(updatedSettings);
|
||||||
|
return 0;
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.error("Email Sync failed due to ", e);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "check-connection",
|
name = "check-connection",
|
||||||
description =
|
description =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user