diff --git a/graylog2-server/src/main/java/org/graylog/plugins/views/storage/migration/state/actions/MigrationActionsImpl.java b/graylog2-server/src/main/java/org/graylog/plugins/views/storage/migration/state/actions/MigrationActionsImpl.java index bd4bb056aded..4fe3e76827a2 100644 --- a/graylog2-server/src/main/java/org/graylog/plugins/views/storage/migration/state/actions/MigrationActionsImpl.java +++ b/graylog2-server/src/main/java/org/graylog/plugins/views/storage/migration/state/actions/MigrationActionsImpl.java @@ -18,15 +18,21 @@ import jakarta.inject.Inject; import org.graylog.plugins.views.storage.migration.state.persistence.DatanodeMigrationConfiguration; +import org.graylog.security.certutil.CaService; +import org.graylog.security.certutil.ca.exceptions.KeyStoreStorageException; +import org.graylog2.plugin.certificates.RenewalPolicy; import org.graylog2.plugin.cluster.ClusterConfigService; public class MigrationActionsImpl implements MigrationActions { private final ClusterConfigService clusterConfigService; + private final CaService caService; @Inject - public MigrationActionsImpl(ClusterConfigService clusterConfigService) { + public MigrationActionsImpl(final ClusterConfigService clusterConfigService, + final CaService caService) { this.clusterConfigService = clusterConfigService; + this.caService = caService; } @Override @@ -86,19 +92,20 @@ public void startMessageProcessing() { @Override public boolean caDoesNotExist() { - // TODO: add real test - return true; + try { + return this.caService.get() == null; + } catch (KeyStoreStorageException e) { + return true; + } } @Override public boolean removalPolicyDoesNotExist() { - // TODO: add real test - return true; + return this.clusterConfigService.get(RenewalPolicy.class) == null; } @Override public boolean caAndRemovalPolicyExist() { - // TODO: add real test - return true; + return !caDoesNotExist() && !removalPolicyDoesNotExist(); } }