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

   > > > @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;
   > ```
   @weizhouapache 
   While the proposed implementation provides clarity, it's not intuitive. 
Since changes are already necessary, instead of merely guiding users through an 
arbitrary process, the aim should be to enhance overall code understanding and 
user experience.
   
   The `force` flag should be more than enough to address any remaining 
concerns. This flag serves as a clear indicator that the operation requires 
careful execution and is not intended for routine use.
   
   Besides, deleting the current `SYSTEM` template does not pose a significant 
risk to the environment, as it can be reuploaded.


-- 
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