summaryrefslogtreecommitdiffstats
path: root/node-repository/src/main/java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2023-02-20 16:56:05 +0100
committerGitHub <noreply@github.com>2023-02-20 16:56:05 +0100
commit4f3121fdb4e86a8df0760c3b06113cceaac36160 (patch)
treea893c29d2b58bfbc174aafa8033e0488bec0ebe5 /node-repository/src/main/java
parent4c63cacc52cdbb507d504e97a0dfa6d9c6f081e4 (diff)
parentb177f78b379fb0310810387401055b53ce2ec9bf (diff)
Merge pull request #26118 from vespa-engine/bratseth/duplicate-node-is-illegal-state
Assume a duplicate node is an illegal state, not an erronous request
Diffstat (limited to 'node-repository/src/main/java')
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java
index 9134c376f38..5690a685345 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java
@@ -126,7 +126,7 @@ public class Nodes {
illegal("Cannot add " + node + ": Child nodes need to be allocated");
Optional<Node> existing = node(node.hostname());
if (existing.isPresent())
- illegal("Cannot add " + node + ": A node with this name already exists");
+ throw new IllegalStateException("Cannot add " + node + ": A node with this name already exists");
}
return db.addNodesInState(nodes.asList(), Node.State.reserved, Agent.system);
}
@@ -152,7 +152,7 @@ public class Nodes {
Optional<Node> existing = node(node.hostname());
if (existing.isPresent()) {
if (existing.get().state() != Node.State.deprovisioned)
- illegal("Cannot add " + node + ": A node with this name already exists");
+ throw new IllegalStateException("Cannot add " + node + ": A node with this name already exists");
node = node.with(existing.get().history());
node = node.with(existing.get().reports());
node = node.with(node.status().withFailCount(existing.get().status().failCount()));