summaryrefslogtreecommitdiffstats
path: root/config-provisioning
diff options
context:
space:
mode:
authorHåkon Hallingstad <hakon@yahooinc.com>2023-10-25 14:14:07 +0200
committerHåkon Hallingstad <hakon@yahooinc.com>2023-10-25 14:14:07 +0200
commit229648eef11a91f3ade59acbbe42776f1e3ed029 (patch)
tree2936fae28ec3d36ef9f80896816480348b623c55 /config-provisioning
parent2695d14822d91b0e00c4c46ae4fbdcca707a327f (diff)
Take parent lock only for tenant app in GCP/AWS
Diffstat (limited to 'config-provisioning')
-rw-r--r--config-provisioning/src/main/java/com/yahoo/config/provision/NodeType.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/NodeType.java b/config-provisioning/src/main/java/com/yahoo/config/provision/NodeType.java
index 266ede04800..0eac568ec45 100644
--- a/config-provisioning/src/main/java/com/yahoo/config/provision/NodeType.java
+++ b/config-provisioning/src/main/java/com/yahoo/config/provision/NodeType.java
@@ -88,6 +88,14 @@ public enum NodeType {
return childNodeTypes.contains(type);
}
+ /** Returns the parent host type. */
+ public NodeType parentNodeType() {
+ for (var type : values()) {
+ if (type.childNodeTypes.contains(this)) return type;
+ }
+ throw new IllegalStateException(this + " has no parent");
+ }
+
/** Returns the host type of this */
public NodeType hostType() {
if (isHost()) return this;
@@ -97,7 +105,7 @@ public enum NodeType {
return nodeType;
}
}
- throw new IllegalArgumentException("No host of " + this + " exists");
+ throw new IllegalStateException("No host of " + this + " exists");
}
}