Skip to content

Commit 2d7e0c2

Browse files
trying new approach
1 parent 7b5a14d commit 2d7e0c2

File tree

6 files changed

+6
-36
lines changed

6 files changed

+6
-36
lines changed

api/src/main/java/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class UpdateCfgCmd extends BaseCmd {
4848
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the configuration")
4949
private String cfgName;
5050

51-
@Parameter(name = ApiConstants.VALUE, type = CommandType.STRING, required = true, description = "the value of the configuration", length = 4096)
51+
@Parameter(name = ApiConstants.VALUE, type = CommandType.STRING, description = "the value of the configuration", length = 4096)
5252
private String value;
5353

5454
@Parameter(name = ApiConstants.ZONE_ID,

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,10 @@ public Configuration updateConfiguration(final UpdateCfgCmd cmd) throws InvalidP
10301030
category = config.getCategory();
10311031
}
10321032

1033+
if (value == null) {
1034+
throw new InvalidParameterValueException(String.format("A value for the [%s] configuration must be informed.", name));
1035+
}
1036+
10331037
validateIpAddressRelatedConfigValues(name, value);
10341038
validateConflictingConfigValue(name, value);
10351039

test/integration/smoke/test_deploy_vm_extra_config_data.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,6 @@ def setUp(self):
125125

126126
# Ste Global Config value
127127
def add_global_config(self, name, value):
128-
if len(value) == 0:
129-
value = ' '
130-
131128
self.apiclient = self.testClient.getApiClient()
132129
self.hypervisor = self.testClient.getHypervisorInfo()
133130
self.dbclient = self.testClient.getDbConnection()

test/integration/smoke/test_global_settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def tearDown(self):
7979

8080
updateConfigurationCmd = updateConfiguration.updateConfigurationCmd()
8181
updateConfigurationCmd.name = "commands.timeout"
82-
updateConfigurationCmd.value = " "
82+
updateConfigurationCmd.value = ""
8383
self.apiClient.updateConfiguration(updateConfigurationCmd)
8484

8585
class TestListConfigurations(cloudstackTestCase):

test/integration/smoke/test_vm_strict_host_tags.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,6 @@ def expunge_vm(self, vm):
9797

9898
@classmethod
9999
def updateConfiguration(self, name, value):
100-
if len(value) == 0:
101-
value = ' '
102-
103100
cmd = updateConfiguration.updateConfigurationCmd()
104101
cmd.name = name
105102
cmd.value = value
@@ -268,9 +265,6 @@ def expunge_vm(self, vm):
268265

269266
@classmethod
270267
def updateConfiguration(self, name, value):
271-
if len(value) == 0:
272-
value = ' '
273-
274268
cmd = updateConfiguration.updateConfigurationCmd()
275269
cmd.name = name
276270
cmd.value = value
@@ -391,9 +385,6 @@ def expunge_vm(self, vm):
391385

392386
@classmethod
393387
def updateConfiguration(self, name, value):
394-
if len(value) == 0:
395-
value = ' '
396-
397388
cmd = updateConfiguration.updateConfigurationCmd()
398389
cmd.name = name
399390
cmd.value = value
@@ -518,9 +509,6 @@ def expunge_vm(self, vm):
518509

519510
@classmethod
520511
def updateConfiguration(self, name, value):
521-
if len(value) == 0:
522-
value = ' '
523-
524512
cmd = updateConfiguration.updateConfigurationCmd()
525513
cmd.name = name
526514
cmd.value = value

ui/src/views/setting/ConfigurationValue.vue

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -275,14 +275,6 @@ export default {
275275
if (configrecord.type === 'WhitespaceSeparatedListWithOptions') {
276276
newValue = newValue.join(' ')
277277
}
278-
279-
// The updateConfiguration API expects a blank string to clean up the configuration value
280-
if (
281-
(['CSV', 'Order', 'WhitespaceSeparatedListWithOptions', 'String'].includes(configrecord.type) && newValue.length === 0)
282-
) {
283-
newValue = ' '
284-
}
285-
286278
const params = {
287279
[this.scopeKey]: this.$route.params?.id,
288280
name: configrecord.name,
@@ -370,17 +362,6 @@ export default {
370362
}
371363
return 0
372364
}
373-
374-
if (configrecord.value?.trim().length === 0) {
375-
if (['CSV', 'Order', 'WhitespaceSeparatedListWithOptions'].includes(configrecord.type)) {
376-
return []
377-
}
378-
379-
if (configrecord.type === 'String') {
380-
return ''
381-
}
382-
}
383-
384365
if (['Order', 'CSV'].includes(configrecord.type)) {
385366
if (configrecord.value && configrecord.value.length > 0) {
386367
return String(configrecord.value).split(',')

0 commit comments

Comments
 (0)