Closed kqdeng closed 3 years ago
@kdeng3849 @gianarb ,
The reason behind doing a soft delete for template was to keep the workflow and whenever user wants to do a workflow get <workflow_id>
it should get the workflow. But this is not happening right now as we are getting error while getting the workflow after deletion of it's template. And this is what we need to fix first.
Also regarding issue where user is not able to create a new template with the same name even after deleting the existing one, this is also an issue and needed a fix.
As per the above comment, I would like to do following fixes for this issue:
Please let me know if you feel any concern with the approach or fixes asap.
So is there no way to permanently delete a workflow template? It seems weird to me as a user that if I delete something it still hangs around.
Expected Behaviour
Templates can be successfully created even when it shares the same name as a deleted template.
Current Behaviour
Due to the fact that templates are soft deleted and the recent change of name also being a unique field, creating a template sharing the same name as a deleted template returns this error:
Possible Solution
Steps to Reproduce (for bugs)
Context
At first, I thought the soft delete was to be able to get workflow data even after the associated template has been (soft) deleted, but this is not the case. Therefore, what exactly is the purpose of soft deleting?
Granted, there is a workaround for this (e.g. use a UUID as part of the name), but it seems unintuitive that new templates have to take deleted templates into consideration. Also, the only way to see what names have already been used is going into the db.
Your Environment
Operating System and version (e.g. Linux, Windows, MacOS): Ubuntu 18.04
How are you running Tinkerbell? Using Vagrant & VirtualBox, Vagrant & Libvirt, on Packet using Terraform, or give details:
Packet using Terraform (sandbox)
running all the latest images as of 11/11
added a unique constraint on template name in the db to match what's currently in the tink migrations
Link to your project or a code example to reproduce issue:
Reproducing the error
Getting a workflow with a deleted associated template
Original reporter: Matt Burns