Skip to content

Commit 8c9b421

Browse files
config depot fixes
1 parent 9e387b1 commit 8c9b421

File tree

2 files changed

+25
-11
lines changed

2 files changed

+25
-11
lines changed

engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41610to41700.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ private Pair<Long, Long> getConfigurationGroupAndSubGroup(Connection conn, Strin
169169
for (String configKeyword : keywordsList) {
170170
if (StringUtils.isNotBlank(configKeyword)) {
171171
configKeyword = configKeyword.strip();
172-
if (configKeyword.equalsIgnoreCase(name) || configKeyword.toLowerCase().startsWith(name.toLowerCase())) {
172+
if (configKeyword.equalsIgnoreCase(name)) {
173173
subGroupId = keywordsSubGroupId;
174174
groupId = keywordsGroupId;
175175
return new Pair<Long, Long>(groupId, subGroupId);

framework/config/src/main/java/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -188,23 +188,40 @@ private void createOrupdateConfigObject(Date date, String componentName, ConfigK
188188

189189
_configDao.persist(vo);
190190
} else {
191+
boolean configUpdated = false;
191192
if (vo.isDynamic() != key.isDynamic() || !ObjectUtils.equals(vo.getDescription(), key.description()) || !ObjectUtils.equals(vo.getDefaultValue(), key.defaultValue()) ||
192193
!ObjectUtils.equals(vo.getScope(), key.scope().toString()) ||
193-
!ObjectUtils.equals(vo.getComponent(), componentName) ||
194-
(key.displayText() != null && !ObjectUtils.equals(vo.getDisplayText(), key.displayText())) ||
195-
(key.parent() != null && !ObjectUtils.equals(vo.getParent(), key.parent())) ||
196-
(key.group() != null && vo.getGroupId() != groupId) ||
197-
(key.subGroup() != null && vo.getSubGroupId() != subGroupId)) {
194+
!ObjectUtils.equals(vo.getComponent(), componentName)) {
198195
vo.setDynamic(key.isDynamic());
199196
vo.setDescription(key.description());
200-
vo.setDisplayText(key.displayText());
201197
vo.setDefaultValue(key.defaultValue());
202198
vo.setScope(key.scope().toString());
203199
vo.setComponent(componentName);
200+
vo.setUpdated(date);
201+
configUpdated = true;
202+
}
203+
204+
if (key.displayText() != null && !ObjectUtils.equals(vo.getDisplayText(), key.displayText())) {
205+
vo.setDisplayText(key.displayText());
206+
configUpdated = true;
207+
}
208+
209+
if (key.parent() != null && !ObjectUtils.equals(vo.getParent(), key.parent())) {
204210
vo.setParent(key.parent());
211+
configUpdated = true;
212+
}
213+
214+
if (key.group() != null && vo.getGroupId() != groupId) {
205215
vo.setGroupId(groupId);
216+
configUpdated = true;
217+
}
218+
219+
if (key.subGroup() != null && vo.getSubGroupId() != subGroupId) {
206220
vo.setSubGroupId(subGroupId);
207-
vo.setUpdated(date);
221+
configUpdated = true;
222+
}
223+
224+
if (configUpdated) {
208225
_configDao.persist(vo);
209226
}
210227
}
@@ -285,9 +302,6 @@ private Pair<Long, Long> getConfigurationGroupAndSubGroupByName(String configNam
285302
if (nameWords.length > 0) {
286303
for (int index = 0; index < nameWords.length; index++) {
287304
ConfigurationSubGroupVO configSubGroup = _configSubGroupDao.findByName(nameWords[index]);
288-
if (configSubGroup == null) {
289-
configSubGroup = _configSubGroupDao.startsWithName(nameWords[index]);
290-
}
291305

292306
if (configSubGroup == null) {
293307
configSubGroup = _configSubGroupDao.findByKeyword(nameWords[index]);

0 commit comments

Comments
 (0)