Skip to content

Commit e4beb1f

Browse files
Add empty config value for scope based config setting (#5551)
1 parent e198edf commit e4beb1f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -826,12 +826,6 @@ public Configuration updateConfiguration(final UpdateCfgCmd cmd) throws InvalidP
826826
return _configDao.findByName(name);
827827
}
828828

829-
value = value.trim();
830-
831-
if (value.isEmpty() || value.equals("null")) {
832-
value = null;
833-
}
834-
835829
String scope = null;
836830
Long id = null;
837831
int paramCountCheck = 0;
@@ -871,6 +865,12 @@ public Configuration updateConfiguration(final UpdateCfgCmd cmd) throws InvalidP
871865
throw new InvalidParameterValueException("cannot handle multiple IDs, provide only one ID corresponding to the scope");
872866
}
873867

868+
value = value.trim();
869+
870+
if (value.isEmpty() || value.equals("null")) {
871+
value = (id == null) ? null : "";
872+
}
873+
874874
final String updatedValue = updateConfiguration(userId, name, catergory, value, scope, id);
875875
if (value == null && updatedValue == null || updatedValue.equalsIgnoreCase(value)) {
876876
return _configDao.findByName(name);

0 commit comments

Comments
 (0)