From 6dc3385fc4babcae5e8d5d2a04b3caa8b3ee95bd Mon Sep 17 00:00:00 2001 From: Petar Dzepina Date: Wed, 3 Aug 2022 23:46:12 +0200 Subject: [PATCH] fixed IT fail Signed-off-by: Petar Dzepina --- .../step/rollup/AttemptCreateRollupJobStep.kt | 3 ++- .../rollup/action/index/TransportIndexRollupAction.kt | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/step/rollup/AttemptCreateRollupJobStep.kt b/src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/step/rollup/AttemptCreateRollupJobStep.kt index e63da08f1..19ffe6b1a 100644 --- a/src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/step/rollup/AttemptCreateRollupJobStep.kt +++ b/src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/step/rollup/AttemptCreateRollupJobStep.kt @@ -7,6 +7,7 @@ package org.opensearch.indexmanagement.indexstatemanagement.step.rollup import org.apache.logging.log4j.LogManager import org.opensearch.ExceptionsHelper +import org.opensearch.OpenSearchException import org.opensearch.action.support.WriteRequest import org.opensearch.action.support.master.AcknowledgedResponse import org.opensearch.index.engine.VersionConflictEngineException @@ -62,7 +63,7 @@ class AttemptCreateRollupJobStep(private val action: RollupAction) : Step(name) } } catch (e: RemoteTransportException) { processFailure(rollup.id, indexName, ExceptionsHelper.unwrapCause(e) as Exception) - } catch (e: Exception) { + } catch (e: OpenSearchException) { processFailure(rollup.id, indexName, e) } diff --git a/src/main/kotlin/org/opensearch/indexmanagement/rollup/action/index/TransportIndexRollupAction.kt b/src/main/kotlin/org/opensearch/indexmanagement/rollup/action/index/TransportIndexRollupAction.kt index d73d1c8d6..251ab7767 100644 --- a/src/main/kotlin/org/opensearch/indexmanagement/rollup/action/index/TransportIndexRollupAction.kt +++ b/src/main/kotlin/org/opensearch/indexmanagement/rollup/action/index/TransportIndexRollupAction.kt @@ -92,6 +92,14 @@ class TransportIndexRollupAction @Inject constructor( if (response.isAcknowledged) { log.info("Successfully created or updated $INDEX_MANAGEMENT_INDEX with newest mappings.") if (request.opType() == DocWriteRequest.OpType.CREATE) { + if (!validateTargetIndexName()) { + return actionListener.onFailure( + OpenSearchStatusException( + "target_index value is invalid: ${request.rollup.targetIndex}", + RestStatus.BAD_REQUEST + ) + ) + } putRollup() } else { getRollup()