Disallow unparking of a host being rebuilt
@@ -323,8 +323,9 @@ public class Nodes {
return park(node.hostname(), false, agent, reason, transaction);
} else {
Node.State toState = Node.State.dirty;
- if (node.state() == Node.State.parked && node.status().wantToDeprovision()) {
- throw new IllegalArgumentException("Cannot move " + node + " to " + toState + ": It's being deprovisioned");
+ if (node.state() == Node.State.parked) {
+ if (node.status().wantToDeprovision()) throw new IllegalArgumentException("Cannot move " + node + " to " + toState + ": It's being deprovisioned");
+ if (node.status().wantToRebuild()) throw new IllegalArgumentException("Cannot move " + node + " to " + toState + ": It's being rebuilt");
}
return db.writeTo(toState, List.of(node), agent, Optional.of(reason), transaction).get(0);
}
