Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
Signed-off-by: bowenlan-amzn <[email protected]>
  • Loading branch information
bowenlan-amzn committed Oct 11, 2023
1 parent 8b48e04 commit a0d88f4
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -464,22 +464,21 @@ object ManagedIndexRunner :
}

private suspend fun initManagedIndex(managedIndexConfig: ManagedIndexConfig) {
var policy: Policy = managedIndexConfig.policy
val policy: Policy = managedIndexConfig.policy
var metadata = getInitializedManagedIndexMetaData(managedIndexConfig, policy, policy.id)

// User may change policy before first metadata initialization
if (managedIndexConfig.changePolicy != null) {
val policyID = managedIndexConfig.changePolicy.policyID
val newPolicy = getPolicy(policyID)
if (newPolicy != null) {
policy = newPolicy
val saved = savePolicyToManagedIndexConfig(managedIndexConfig, policy)
val saved = savePolicyToManagedIndexConfig(managedIndexConfig, newPolicy)
if (!saved) {
logger.error("Failed to save policy to ManagedIndexConfig(${managedIndexConfig.index})")
return

Check warning on line 478 in src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/ManagedIndexRunner.kt

View check run for this annotation

Codecov / codecov/patch

src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/ManagedIndexRunner.kt#L477-L478

Added lines #L477 - L478 were not covered by tests
}
}
metadata = getInitializedManagedIndexMetaData(managedIndexConfig, policy, policyID)
metadata = getInitializedManagedIndexMetaData(managedIndexConfig, newPolicy, policyID)
}

updateManagedIndexMetaData(metadata, create = true)
Expand Down

0 comments on commit a0d88f4

Please sign in to comment.