Repository: stratos Updated Branches: refs/heads/docker-integration 9cb881f03 -> 309858979
Fixing MIN_COUNT and LB_CLUSTER_ID read issue in cartridge agent. Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/30985897 Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/30985897 Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/30985897 Branch: refs/heads/docker-integration Commit: 309858979b07a8a597e4716de6ccab079aa568ec Parents: 9cb881f Author: sajhak <[email protected]> Authored: Sat Sep 20 12:00:38 2014 +0530 Committer: sajhak <[email protected]> Committed: Sat Sep 20 12:00:38 2014 +0530 ---------------------------------------------------------------------- .../config/CartridgeAgentConfiguration.java | 34 ++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/30985897/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/config/CartridgeAgentConfiguration.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/config/CartridgeAgentConfiguration.java b/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/config/CartridgeAgentConfiguration.java index eb88907..96a8e1e 100644 --- a/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/config/CartridgeAgentConfiguration.java +++ b/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/config/CartridgeAgentConfiguration.java @@ -93,8 +93,8 @@ public class CartridgeAgentConfiguration { listenAddress = System.getProperty(CartridgeAgentConstants.LISTEN_ADDRESS); isInternalRepo = readInternalRepo(CartridgeAgentConstants.PROVIDER); tenantId = readParameterValue(CartridgeAgentConstants.TENANT_ID); - lbClusterId = readParameterValue(CartridgeAgentConstants.LB_CLUSTER_ID); - minCount = readParameterValue(CartridgeAgentConstants.MIN_INSTANCE_COUNT); + lbClusterId = readLBClusterIdValue(CartridgeAgentConstants.LB_CLUSTER_ID); + minCount = readMinCountValue(CartridgeAgentConstants.MIN_INSTANCE_COUNT); // not mandatory lbPrivateIp = System.getProperty(CartridgeAgentConstants.LB_PRIVATE_IP); lbPublicIp = System.getProperty(CartridgeAgentConstants.LB_PUBLIC_IP); @@ -135,6 +135,36 @@ public class CartridgeAgentConfiguration { return null; } + private String readLBClusterIdValue(String lbClusterId) { + String lbClusterIdValue = null; + if (parameters.containsKey(lbClusterId)) { + lbClusterIdValue = parameters.get(lbClusterId); + } + + if (System.getProperty(lbClusterId) != null) { + lbClusterIdValue = System.getProperty(lbClusterId); + } + return lbClusterIdValue; + } + + private String readMinCountValue(String minCountParam) throws ParameterNotFoundException { + + String minCountValue = null; + if (parameters.containsKey(minCountParam)) { + minCountValue = parameters.get(minCountParam); + } + if (System.getProperty(minCountParam) != null) { + minCountValue = System.getProperty(minCountParam); + } + + if (Boolean.parseBoolean(isClustered)) { + String message = "Cannot find the value of required parameter: " + minCountParam; + throw new ParameterNotFoundException(message); + } + return minCountValue; + } + + private String readManagerServiceType(){ if (deployment == null) {
