diff --git a/README.md b/README.md index 4220e97..54f5f27 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,23 @@ Configuration: - Users will need to add those keys to storage in addition to entering them as password on the configuration page. +Note: + +Note that Rancher uses container ID to to construct the URL used to make API requests. +When services are upgraded, new containers are created so the API urls used in the +node operations cannot work anymore. The container does not exist, so the URL will +fail. As long nodes are defined by containers, there is probably no way to avoid this. + +The result is that file copies and node executions will not work when performed in the +same execution context after an upgrade because the node set is defined in that job +context. The Rundeck solution to this issue is to do the upgrade then: + + 1. Run a "Refresh Nodes" workflow step + 2. Run the node execute or file copy step as a job reference + +Note that refreshing nodes, Rundeck changes the nodes in the global context, but not +the running job. So it is essential that the execution is in a job reference and not +in the same job context. ### Rancher Node Executor diff --git a/src/main/java/com/bioraft/rundeck/rancher/RancherWebSocketListener.java b/src/main/java/com/bioraft/rundeck/rancher/RancherWebSocketListener.java index ff799ba..9484c32 100644 --- a/src/main/java/com/bioraft/rundeck/rancher/RancherWebSocketListener.java +++ b/src/main/java/com/bioraft/rundeck/rancher/RancherWebSocketListener.java @@ -351,8 +351,7 @@ private JsonNode getToken(boolean attachStdout) throws IOException { * @throws JsonMappingException When JSON is invalid. * @throws JsonProcessingException When JSON is invalid. */ - private String apiData(boolean attachStdout) - throws JsonMappingException, JsonProcessingException { + private String apiData(boolean attachStdout) throws JsonProcessingException { ObjectMapper mapper = new ObjectMapper(); JsonNode root = mapper.readTree("{}"); ((ObjectNode) root).put("tty", false); diff --git a/src/test/java/com/bioraft/rundeck/rancher/RancherManageServiceTest.java b/src/test/java/com/bioraft/rundeck/rancher/RancherManageServiceTest.java index 8a0afd0..870c8fb 100644 --- a/src/test/java/com/bioraft/rundeck/rancher/RancherManageServiceTest.java +++ b/src/test/java/com/bioraft/rundeck/rancher/RancherManageServiceTest.java @@ -104,6 +104,8 @@ public void testActivate() throws IOException, NodeStepException { subject.executeNodeStep(ctx, cfg, node); verify(client, times(1)).get(any()); verify(client, times(1)).post(any(), eq("")); + verify(logger, times(1)). + log(eq(com.dtolabs.rundeck.core.Constants.INFO_LEVEL), matches("Step activate complete on .*")); } @Test @@ -121,6 +123,8 @@ public void testDeactivate() throws IOException, NodeStepException { subject.executeNodeStep(ctx, cfg, node); verify(client, times(1)).get(any()); verify(client, times(1)).post(any(), eq("")); + verify(logger, times(1)). + log(eq(com.dtolabs.rundeck.core.Constants.INFO_LEVEL), matches("Step deactivate complete on .*")); } @Test @@ -138,6 +142,8 @@ public void testRestart() throws IOException, NodeStepException { subject.executeNodeStep(ctx, cfg, node); verify(client, times(1)).get(any()); verify(client, times(1)).post(any(), eq("")); + verify(logger, times(1)). + log(eq(com.dtolabs.rundeck.core.Constants.INFO_LEVEL), matches("Step restart complete on .*")); } @Test(expected = NodeStepException.class)