Default value of force should be false for template delete operation (#7731)

* default value of force should be false

* Added force flag in tests
This commit is contained in:
Harikrishna 2023-10-10 15:49:57 +05:30 committed by GitHub
parent e290ac5451
commit a9f3af85cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -16,6 +16,7 @@
// under the License. // under the License.
package org.apache.cloudstack.api.command.user.template; package org.apache.cloudstack.api.command.user.template;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.APICommand;
@ -67,8 +68,9 @@ public class DeleteTemplateCmd extends BaseAsyncCmd {
} }
public boolean isForced() { public boolean isForced() {
return (forced != null) ? forced : true; return BooleanUtils.toBooleanDefaultIfNull(forced, false);
} }
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
/////////////// API Implementation/////////////////// /////////////// API Implementation///////////////////
///////////////////////////////////////////////////// /////////////////////////////////////////////////////

View File

@ -115,6 +115,7 @@ class TestCreateTemplateWithChecksum(cloudstackTestCase):
cmd = deleteTemplate.deleteTemplateCmd() cmd = deleteTemplate.deleteTemplateCmd()
cmd.id = temp.id cmd.id = temp.id
cmd.zoneid = self.zone.id cmd.zoneid = self.zone.id
cmd.forced = True
self.apiclient.deleteTemplate(cmd) self.apiclient.deleteTemplate(cmd)
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)