diff options
author | Jon Bratseth <bratseth@gmail.com> | 2023-02-20 16:26:05 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2023-02-20 16:26:05 +0100 |
commit | b177f78b379fb0310810387401055b53ce2ec9bf (patch) | |
tree | 7b8b3ebc59ebd0c6c401271a2c4171db9a4ef571 /node-repository/src/main/java/com/yahoo | |
parent | c4ddd4bd951d319437a38ead21037d9c17f1b70d (diff) |
Assume a duplicate node is an illegal state, not an erronous request
Diffstat (limited to 'node-repository/src/main/java/com/yahoo')
-rw-r--r-- | node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java | 4 |
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())); |