summaryrefslogtreecommitdiffstats
path: root/node-admin
diff options
context:
space:
mode:
authorHarald Musum <musum@yahoo-inc.com>2016-09-06 14:07:22 +0200
committerHarald Musum <musum@yahoo-inc.com>2016-09-06 14:07:22 +0200
commit3d24988d5b3161bef797fe39fd36d4b6e78fc8c3 (patch)
treec8ad0064651404c157c514d3428a0ad4919aefac /node-admin
parent9567c30842f06ff8c11ce5676105df8930e7a09d (diff)
Minor refactoring
Diffstat (limited to 'node-admin')
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java23
1 files changed, 14 insertions, 9 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java
index 91cc8490c8b..e216a4e5ad3 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java
@@ -170,7 +170,18 @@ public class NodeAgentImpl implements NodeAgent {
containerState = RUNNING;
}
- private void publishStateToNodeRepoIfChanged(final ContainerNodeSpec nodeSpec) throws IOException {
+ private void updateNodeRepoAndMarkNodeAsReady(ContainerNodeSpec nodeSpec) throws IOException {
+ publishStateToNodeRepoIfChanged(
+ nodeSpec.hostname,
+ // Clear current Docker image and vespa version, as nothing is running on this node
+ new NodeAttributes(
+ nodeSpec.wantedRestartGeneration.get(),
+ new DockerImage(""),
+ ""));
+ nodeRepository.markAsReady(nodeSpec.hostname);
+ }
+
+ private void updateNodeRepoWithCurrentAttributes(final ContainerNodeSpec nodeSpec) throws IOException {
final String containerVespaVersion = dockerOperations.getVespaVersionOrNull(nodeSpec.containerName);
publishStateToNodeRepoIfChanged(nodeSpec.hostname, new NodeAttributes(
nodeSpec.wantedRestartGeneration.get(),
@@ -316,7 +327,7 @@ public class NodeAgentImpl implements NodeAgent {
// has been successfully rolled out.
// - Slobrok and internal orchestrator state is used to determine whether
// to allow upgrade (suspend).
- publishStateToNodeRepoIfChanged(nodeSpec);
+ updateNodeRepoWithCurrentAttributes(nodeSpec);
logger.info("Call resume against Orchestrator");
orchestrator.resume(nodeSpec.hostname);
break;
@@ -330,13 +341,7 @@ public class NodeAgentImpl implements NodeAgent {
removeContainerIfNeededUpdateContainerState(nodeSpec);
logger.info("State is " + nodeSpec.nodeState + ", will delete application storage and mark node as ready");
maintenanceScheduler.deleteContainerStorage(nodeSpec.containerName);
- publishStateToNodeRepoIfChanged(nodeSpec.hostname,
- // Clear current Docker image and vespa version, as nothing is running on this node
- new NodeAttributes(
- nodeSpec.wantedRestartGeneration.get(),
- new DockerImage(""),
- ""));
- nodeRepository.markAsReady(nodeSpec.hostname);
+ updateNodeRepoAndMarkNodeAsReady(nodeSpec);
break;
case FAILED:
removeContainerIfNeededUpdateContainerState(nodeSpec);