diff options
author | Martin Polden <mpolden@mpolden.no> | 2021-11-30 14:53:11 +0100 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2021-11-30 14:53:11 +0100 |
commit | 3a898779f312a7d039d860f0f63d4550e14fbe38 (patch) | |
tree | afa27ee1e5ee0e0aa563aed7f1c5359d8183a45c /config-model-api | |
parent | d0476e64b77f9cde4324cd1bbc1366fd24281ef6 (diff) |
Make active attribute on region tag optional
This allows tenants to stop specifying the attribute, as it's unnecessary when
declaring global endpoints with the current syntax (`<endpoints>`).
Diffstat (limited to 'config-model-api')
2 files changed, 4 insertions, 3 deletions
diff --git a/config-model-api/src/main/java/com/yahoo/config/application/api/xml/DeploymentSpecXmlReader.java b/config-model-api/src/main/java/com/yahoo/config/application/api/xml/DeploymentSpecXmlReader.java index 6f77dce8fc5..07b8462f4d1 100644 --- a/config-model-api/src/main/java/com/yahoo/config/application/api/xml/DeploymentSpecXmlReader.java +++ b/config-model-api/src/main/java/com/yahoo/config/application/api/xml/DeploymentSpecXmlReader.java @@ -477,9 +477,10 @@ public class DeploymentSpecXmlReader { private boolean readActive(Element regionTag) { String activeValue = regionTag.getAttribute("active"); + if ("".equals(activeValue)) return true; // Default to active if ("true".equals(activeValue)) return true; if ("false".equals(activeValue)) return false; - throw new IllegalArgumentException("Region tags must have an 'active' attribute set to 'true' or 'false' " + + throw new IllegalArgumentException("Value of 'active' attribute in region tag must be 'true' or 'false' " + "to control whether this region should receive traffic from the global endpoint of this application"); } diff --git a/config-model-api/src/test/java/com/yahoo/config/application/api/DeploymentSpecTest.java b/config-model-api/src/test/java/com/yahoo/config/application/api/DeploymentSpecTest.java index 74e79d5e8cf..43ccc34284f 100644 --- a/config-model-api/src/test/java/com/yahoo/config/application/api/DeploymentSpecTest.java +++ b/config-model-api/src/test/java/com/yahoo/config/application/api/DeploymentSpecTest.java @@ -1162,8 +1162,8 @@ public class DeploymentSpecTest { var spec = DeploymentSpec.fromXml("<deployment>" + " <instance id='default'>" + " <prod>" + - " <region active=\"true\">us-east</region>" + - " <region active=\"true\">us-west</region>" + + " <region>us-east</region>" + + " <region>us-west</region>" + " </prod>" + " <endpoints>" + " <endpoint id=\"foo\" container-id=\"bar\">" + |