diff --git a/src/main/java/org/opensearch/flowframework/indices/FlowFrameworkIndicesHandler.java b/src/main/java/org/opensearch/flowframework/indices/FlowFrameworkIndicesHandler.java index 741ce4d4f..0547c875a 100644 --- a/src/main/java/org/opensearch/flowframework/indices/FlowFrameworkIndicesHandler.java +++ b/src/main/java/org/opensearch/flowframework/indices/FlowFrameworkIndicesHandler.java @@ -403,9 +403,14 @@ public void updateTemplateInGlobalContext(String documentId, Template template, * @param documentId the document Id * @param template the use-case template * @param listener action listener - * @param force if set true, ignores the requirement that the provisioning is not started + * @param ignoreNotStartedCheck if set true, ignores the requirement that the provisioning is not started */ - public void updateTemplateInGlobalContext(String documentId, Template template, ActionListener listener, boolean force) { + public void updateTemplateInGlobalContext( + String documentId, + Template template, + ActionListener listener, + boolean ignoreNotStartedCheck + ) { if (!doesIndexExist(GLOBAL_CONTEXT_INDEX)) { String errorMessage = "Failed to update template for workflow_id : " + documentId + ", global_context index does not exist."; logger.error(errorMessage); @@ -415,7 +420,7 @@ public void updateTemplateInGlobalContext(String documentId, Template template, doesTemplateExist(documentId, templateExists -> { if (templateExists) { isWorkflowNotStarted(documentId, workflowIsNotStarted -> { - if (workflowIsNotStarted || force) { + if (workflowIsNotStarted || ignoreNotStartedCheck) { IndexRequest request = new IndexRequest(GLOBAL_CONTEXT_INDEX).id(documentId); try ( XContentBuilder builder = XContentFactory.jsonBuilder(); diff --git a/src/test/java/org/opensearch/flowframework/bwc/FlowFrameworkBackwardsCompatibilityIT.java b/src/test/java/org/opensearch/flowframework/bwc/FlowFrameworkBackwardsCompatibilityIT.java index 9e438714b..108252465 100644 --- a/src/test/java/org/opensearch/flowframework/bwc/FlowFrameworkBackwardsCompatibilityIT.java +++ b/src/test/java/org/opensearch/flowframework/bwc/FlowFrameworkBackwardsCompatibilityIT.java @@ -102,29 +102,29 @@ public static ClusterType parse(String value) { @SuppressWarnings("unchecked") public void testBackwardsCompatibility() throws Exception { + // This iteration of nodes is only to get plugins installed on each node. We don't currently use its functionality but in case we + // ever need version-based dependencies in future BWC tests it will be needed. It's directly copied from similar implementations + // in other plugins. String uri = getUri(); Map> responseMap = (Map>) getAsMap(uri).get("nodes"); for (Map response : responseMap.values()) { List> plugins = (List>) response.get("plugins"); Set pluginNames = plugins.stream().map(map -> map.get("name")).collect(Collectors.toSet()); + assertTrue(pluginNames.contains("opensearch-flow-framework")); String workflowId = createNoopTemplate(); Template t = getTemplate(workflowId); switch (CLUSTER_TYPE) { case OLD: - assertTrue(pluginNames.contains("opensearch-flow-framework")); // mapping for 2.12 does not include time stamps assertNull(t.createdTime()); assertNull(t.lastUpdatedTime()); assertNull(t.lastProvisionedTime()); break; case MIXED: - assertTrue(pluginNames.contains("opensearch-flow-framework")); // Time stamps may or may not be null depending on whether index has been accessed by new version node - // So just test that the template parses assertNull(t.lastProvisionedTime()); break; case UPGRADED: - assertTrue(pluginNames.contains("opensearch-flow-framework")); // mapping for 2.13+ includes time stamps assertNotNull(t.createdTime()); assertEquals(t.createdTime(), t.lastUpdatedTime());