Open skateman opened 3 years ago
Overall, I agree that this needs a rework. STI seems like a decent approach to me. However, it may not be necessary, as I think the architectural direction was to go towards ServiceTemplateGeneric and drop the rest. I might be wrong, though, so we should get together with @lfu @tinaafitz (and probably @gmcculloug) to hash it out.
If we don't go with the STI approach, we have to add some additional complexity that sorts out the provider-specific fields for each subtype here :confused: even though most of the provider-specific stuff is through the provisioning dialogs specified by the YAML files, there are a few fields that are not in the YAML different for each provider :confused:
I started working on the catalog item forms and I am bumping into architectural obstacles. There's only a partial (and a little bit weird) STI implemented around the
ServiceTemplate
model. Right now we're accessing the list of the possible types viaExtManagementSystem.supported_types_for_catalog
and thenExtManagementSystem.catalog_types
which for each catalog returns a hash with one or zero elements indexed by a string that is stored in per record asprov_type
. This string is everything but deterministic, we are doing a lot of map-reduce magic to work with this.As I was going through the models, I found that the following classes are inherited from the
ServiceTemplate
:ServiceTemplateGeneric
ServiceTemplateOrchestration
ServiceTemplateAnsibleTower
ServiceTemplateAnsiblePlaybook
ServiceTemplateContainerTemplate
- but why :cry: sorry :see_no_evil: :rofl:Also these below, but I guess I don't have to deal with them as they seem like v2v models
* `ServiceTemplateTransformationPlan` * `ServiceTemplateTransformationPlanRequest` * `ServiceTemplateTransformationPlanTask`There are some inconsistencies in the mapping of
prov_type
as well, for example when it's set togeneric
it doesn't map toServiceTemplateGeneric
but all the others exceptServiceTemplateOrchestration
are inherited from it. I really tried to work with these without changes, but I realized that I could probably produce cleaner code if I cleaned this up first. So here is my proposal:ServiceTemplate
and use proper STI withtype
as a classI really tried to avoid mentioning DDF in the steps above :laughing: because there are just a few actual DDF fields that should be actually stored in the models, most of the schema is already described in
MiqDialog
records and we just need a way to convert those to the right format (which can be just done on the frontend). The goal here is to have something similar to what we did to the provider forms.@agrare @Fryguy wdyt?