This is an automated email from the ASF dual-hosted git repository.

nvazquez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new e4beb1f  Add empty config value for scope based config setting (#5551)
e4beb1f is described below

commit e4beb1f955c1f43d49af1cc6546c3f791e2adf53
Author: sureshanaparti <[email protected]>
AuthorDate: Wed Oct 6 03:19:33 2021 +0530

    Add empty config value for scope based config setting (#5551)
---
 .../com/cloud/configuration/ConfigurationManagerImpl.java    | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java 
b/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
index 08ba1a3..bea9cd0 100755
--- a/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -826,12 +826,6 @@ public class ConfigurationManagerImpl extends ManagerBase 
implements Configurati
             return _configDao.findByName(name);
         }
 
-        value = value.trim();
-
-        if (value.isEmpty() || value.equals("null")) {
-            value = null;
-        }
-
         String scope = null;
         Long id = null;
         int paramCountCheck = 0;
@@ -871,6 +865,12 @@ public class ConfigurationManagerImpl extends ManagerBase 
implements Configurati
             throw new InvalidParameterValueException("cannot handle multiple 
IDs, provide only one ID corresponding to the scope");
         }
 
+        value = value.trim();
+
+        if (value.isEmpty() || value.equals("null")) {
+            value = (id == null) ? null : "";
+        }
+
         final String updatedValue = updateConfiguration(userId, name, 
catergory, value, scope, id);
         if (value == null && updatedValue == null || 
updatedValue.equalsIgnoreCase(value)) {
             return _configDao.findByName(name);

Reply via email to