stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From im...@apache.org
Subject stratos git commit: Updating kubernetes partition validator
Date Mon, 22 Dec 2014 05:20:28 GMT
Repository: stratos
Updated Branches:
  refs/heads/master 3343cf743 -> fa072c5f6


Updating kubernetes partition validator


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/fa072c5f
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/fa072c5f
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/fa072c5f

Branch: refs/heads/master
Commit: fa072c5f629d952ec42c7e48bacc0c2524f93ab0
Parents: 3343cf7
Author: Imesh Gunaratne <imesh@apache.org>
Authored: Mon Dec 22 10:50:19 2014 +0530
Committer: Imesh Gunaratne <imesh@apache.org>
Committed: Mon Dec 22 10:50:19 2014 +0530

----------------------------------------------------------------------
 .../KubernetesPartitionValidator.java           | 36 +++++++++-----------
 .../impl/CloudControllerServiceUtil.java        |  1 -
 2 files changed, 17 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/fa072c5f/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/KubernetesPartitionValidator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/KubernetesPartitionValidator.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/KubernetesPartitionValidator.java
index 5f189ee..f057e9f 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/KubernetesPartitionValidator.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/KubernetesPartitionValidator.java
@@ -18,8 +18,6 @@
  */
 package org.apache.stratos.cloud.controller.iaases.validators;
 
-import java.util.Properties;
-
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -28,13 +26,14 @@ import org.apache.stratos.cloud.controller.domain.IaasProvider;
 import org.apache.stratos.cloud.controller.domain.Partition;
 import org.apache.stratos.cloud.controller.exception.InvalidPartitionException;
 import org.apache.stratos.cloud.controller.exception.NonExistingKubernetesClusterException;
-import org.apache.stratos.common.constants.StratosConstants;
+
+import java.util.Properties;
 
 /**
  * Kubernetes partition validator
  */
 public class KubernetesPartitionValidator implements PartitionValidator {
-    
+
     private static final Log log = LogFactory.getLog(KubernetesPartitionValidator.class);
 
     private IaasProvider iaasProvider;
@@ -46,8 +45,8 @@ public class KubernetesPartitionValidator implements PartitionValidator
{
 
     /**
      * Validate the given properties for its existent in this partition.
-     * 
-     * @param partition partition.
+     *
+     * @param partition  partition.
      * @param properties set of properties to be validated.
      * @return cloned and modified {@link IaasProvider} which maps to the given partition.
      * @throws InvalidPartitionException if at least one property is evaluated to be invalid.
@@ -55,20 +54,19 @@ public class KubernetesPartitionValidator implements PartitionValidator
{
     public IaasProvider validate(Partition partition, Properties properties) throws InvalidPartitionException
{
 
         String kubernetesClusterId = partition.getKubernetesClusterId();
-        if (StringUtils.isNotBlank(kubernetesClusterId)) {
-            try {
-                CloudControllerContext.getInstance().getKubernetesCluster(kubernetesClusterId);
-                return iaasProvider;
-            } catch (NonExistingKubernetesClusterException e) {
-                String message = "Kubernetes partition is not valid: [partition-id] " + partition.getId();
-                log.error(message, e);
-                throw new InvalidPartitionException(message, e);
-            }
+        if (StringUtils.isBlank(kubernetesClusterId)) {
+            String message = "Kubernetes cluster id not found in partition: [partition-id]
" + partition.getId();
+            log.error(message);
+            throw new InvalidPartitionException(message);
         }
 
-        String message = "Kubernetes partition is not valid: [partition-id] " + partition.getId()
+ ", property not found: "
-                        + StratosConstants.KUBERNETES_CLUSTER_ID;
-        log.error(message);
-        throw new InvalidPartitionException(message);
+        try {
+            CloudControllerContext.getInstance().getKubernetesCluster(kubernetesClusterId);
+            return iaasProvider;
+        } catch (NonExistingKubernetesClusterException e) {
+            String message = "Kubernetes partition is not valid: [partition-id] " + partition.getId();
+            log.error(message, e);
+            throw new InvalidPartitionException(message, e);
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/fa072c5f/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
index 9534ad5..3b703d1 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
@@ -118,5 +118,4 @@ public class CloudControllerServiceUtil {
         validatePartitionAndGetIaasProvider(partition, iaasProvider);
         return true;
     }
-    
 }


Mime
View raw message