Skip to content

Commit 7154a05

Browse files
committed
fix boolean param value for custom action
Signed-off-by: Abhishek Kumar <[email protected]>
1 parent d18dfb2 commit 7154a05

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

api/src/main/java/org/apache/cloudstack/extension/ExtensionCustomAction.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,10 @@ public Object validatedValue(String value) {
290290
try {
291291
switch (type) {
292292
case BOOLEAN:
293-
return Arrays.asList("true", "false").contains(value);
293+
if (!Arrays.asList("true", "false").contains(value)) {
294+
throw new IllegalArgumentException();
295+
}
296+
return Boolean.parseBoolean(value);
294297
case DATE:
295298
return DateUtil.parseTZDateString(value);
296299
case NUMBER:

framework/extensions/src/main/java/org/apache/cloudstack/framework/extensions/manager/ExtensionsManagerImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1347,7 +1347,8 @@ public CustomActionResultResponse runCustomAction(RunCustomActionCmd cmd) {
13471347
runCustomActionCommand.setExternalDetails(externalDetails);
13481348
runCustomActionCommand.setWait(customActionVO.getTimeout());
13491349
try {
1350-
logger.info("Running custom action: {}", GsonHelper.getGson().toJson(runCustomActionCommand));
1350+
logger.info("Running custom action: {} with {} parameters", actionName,
1351+
(parameters != null ? parameters.keySet().size() : 0));
13511352
Answer answer = agentMgr.send(hostId, runCustomActionCommand);
13521353
if (!(answer instanceof RunCustomActionAnswer)) {
13531354
logger.error("Unexpected answer [{}] received for {}", answer.getClass().getSimpleName(),

0 commit comments

Comments
 (0)