Updated Branches:
  refs/heads/master b67a832f7 -> 4a9b2fb58

Since some config values moved to individual ConfigKey<T> from Config.java, 
validation is broken for those keys. Workaround the issue so that 
updateConfiguration API still works


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

Branch: refs/heads/master
Commit: 4a9b2fb584613d23e5a51eb0fd19d33ca92635d9
Parents: b67a832
Author: Chiradeep Vittal <chirad...@apache.org>
Authored: Tue Aug 27 18:04:08 2013 -0700
Committer: Chiradeep Vittal <chirad...@apache.org>
Committed: Tue Aug 27 18:04:30 2013 -0700

----------------------------------------------------------------------
 .../configuration/ConfigurationManagerImpl.java     | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a9b2fb5/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java 
b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index 120e7bb..5550237 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -40,8 +40,6 @@ import javax.naming.NamingException;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.InitialDirContext;
 
-import org.apache.log4j.Logger;
-
 import org.apache.cloudstack.acl.SecurityChecker;
 import org.apache.cloudstack.api.ApiConstants.LDAPParams;
 import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
@@ -87,6 +85,7 @@ import 
org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailVO;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
+import org.apache.log4j.Logger;
 
 import com.cloud.alert.AlertManager;
 import com.cloud.api.ApiDBUtils;
@@ -687,19 +686,24 @@ public class ConfigurationManagerImpl extends ManagerBase 
implements Configurati
 
     private String validateConfigurationValue(String name, String value, 
String scope) {
 
-        Config c = Config.getConfig(name);
-        if (c == null) {
+        ConfigurationVO cfg = _configDao.findByName(name);
+        if (cfg == null) {
             s_logger.error("Missing configuration variable " + name + " in 
configuration table");
             return "Invalid configuration variable.";
         }
-        String configScope = c.getScope();
+
+        String configScope = cfg.getScope();
         if (scope != null) {
             if (!configScope.contains(scope)) {
                 s_logger.error("Invalid scope id provided for the parameter " 
+ name);
                 return "Invalid scope id provided for the parameter " + name;
             }
         }
-
+        Config c = Config.getConfig(name);
+        if (c == null) {
+            s_logger.warn("Did not find configuration " + name + " in 
Config.java. Perhaps moved to ConfigDepot?");
+            return null;
+        }
         Class<?> type = c.getType();
 
         if (value == null) {

Reply via email to