From 229648eef11a91f3ade59acbbe42776f1e3ed029 Mon Sep 17 00:00:00 2001 From: HÃ¥kon Hallingstad Date: Wed, 25 Oct 2023 14:14:07 +0200 Subject: Take parent lock only for tenant app in GCP/AWS --- .../src/main/java/com/yahoo/config/provision/NodeType.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'config-provisioning/src/main/java/com/yahoo/config/provision') 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"); } } -- cgit v1.2.3