weizhouapache commented on PR #8556:
URL: https://github.com/apache/cloudstack/pull/8556#issuecomment-1908566764

   > > @GaOrtiga @DaanHoogland sorry this PR is not needed in my opinion
   > 
   > Having a workaround should not be a reason to restrict an operation. If 
the operator does not know that you can circumvent this restriction they may 
feel obliged to perform the operation directly in the DB, especially since the 
exception thrown is very vague and editing the template's type to make it 
deletable is very non-intuitive.
   
   If the solution is not clear, make it clear then. for example
   ```
   diff --git 
a/server/src/main/java/com/cloud/template/HypervisorTemplateAdapter.java 
b/server/src/main/java/com/cloud/template/HypervisorTemplateAdapter.java
   index b886f0868f6..6456ca452ed 100644
   --- a/server/src/main/java/com/cloud/template/HypervisorTemplateAdapter.java
   +++ b/server/src/main/java/com/cloud/template/HypervisorTemplateAdapter.java
   @@ -749,7 +749,7 @@ public class HypervisorTemplateAdapter extends 
TemplateAdapterBase {
            TemplateProfile profile = super.prepareDelete(cmd);
            VMTemplateVO template = profile.getTemplate();
            if (template.getTemplateType() == TemplateType.SYSTEM) {
   -            throw new InvalidParameterValueException("The DomR template 
cannot be deleted.");
   +            throw new InvalidParameterValueException("The SYSTEM template 
cannot be deleted. Please update template type to USER and retry.");
            }
            checkZoneImageStores(profile.getTemplate(), 
profile.getZoneIdList());
            return profile;
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to