From 6290f42c7b214bd94d90a464d536a9446939f84f Mon Sep 17 00:00:00 2001 From: Harikrishna Patnala Date: Fri, 7 Jul 2023 12:37:30 +0530 Subject: [PATCH 1/2] default value of force should be false --- .../api/command/user/template/DeleteTemplateCmd.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java index 6923751ea774..3d7aaaec31c1 100755 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java @@ -16,6 +16,7 @@ // under the License. package org.apache.cloudstack.api.command.user.template; +import org.apache.commons.lang3.BooleanUtils; import org.apache.log4j.Logger; import org.apache.cloudstack.api.APICommand; @@ -67,8 +68,9 @@ public Long getZoneId() { } public boolean isForced() { - return (forced != null) ? forced : true; + return BooleanUtils.toBooleanDefaultIfNull(forced, false); } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// From 7b3cc99648b037c4f067335442023fdcaea93a0c Mon Sep 17 00:00:00 2001 From: Harikrishna Patnala Date: Mon, 28 Aug 2023 09:48:11 +0530 Subject: [PATCH 2/2] Added force flag in tests --- test/integration/smoke/test_templates.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/integration/smoke/test_templates.py b/test/integration/smoke/test_templates.py index 00ad2201b44b..bd5f522e4405 100644 --- a/test/integration/smoke/test_templates.py +++ b/test/integration/smoke/test_templates.py @@ -115,6 +115,7 @@ def tearDown(self): cmd = deleteTemplate.deleteTemplateCmd() cmd.id = temp.id cmd.zoneid = self.zone.id + cmd.forced = True self.apiclient.deleteTemplate(cmd) except Exception as e: raise Exception("Warning: Exception during cleanup : %s" % e)