tliron / puccini

Cloud topology management and deployment tools based on TOSCA
https://puccini.cloud
Apache License 2.0
88 stars 20 forks source link

importing files containing topology_template unsupported #68

Closed philippemerle closed 3 years ago

philippemerle commented 3 years ago

Importing a file containing a topology template seems to be unsupported by Puccini 0.18.0.

Following is the importing template:

tosca_definitions_version: tosca_simple_yaml_1_3
imports:
  - imported_template.yaml
topology_template:
  node_templates:
    node1:
      type: tosca:Compute

Following is the imported template:

tosca_definitions_version: tosca_simple_yaml_1_3
topology_template:
  node_templates:
    node2:
      type: tosca:Compute

A problem is signaled when compiling the importing template:

$ puccini-tosca compile importing_template.yaml 
PROBLEMS (1)
  file:........./imported_template.yaml
    @3,1 topology_template: unsupported field
$
jpc4242 commented 3 years ago

What you are experiencing here is exactly the same that happens with SOL001 (maybe you are playing with them).

I already discussed this with TAL and we are about to merge my changes (see PR#72) that provide a new quirk imports.ignore.topology_template.

If you are in a hurry and want to test, you may play with my fork at jpc4242/puccini (but my fork is intended to just prepare pull requests for Tal's main project; I encourage you to stay here) UPDATE: Tal already merged the PR, so the new quirks are available.

jpc4242 commented 3 years ago

I forgot to mention the original issue in case you want to look at it: it was #51

philippemerle commented 3 years ago

What you are experiencing here is exactly the same that happens with SOL001 (maybe you are playing with them).

Yes I am playing with them.

jpc4242 commented 3 years ago

Then you will find useful the other quirk added in the same pull request

tliron commented 3 years ago

This behavior is now supported via --quirk imports.topology_template.ignore.

philippemerle commented 3 years ago

Thank you Tal.

Why is it resolved as a quirk? I see nowhere in TOSCA spec that an imported file can not declare a topology template. So the default behaviour should be to not produce a problem when an imported file declares a topology template. Anyway.

tliron commented 3 years ago

Because this seems wrong to me -- there can be only one topology template. There is nothing in the grammar that could explain how two topology templates would be merged together. The spec simply doesn't specify what would happen in this case and in my interpretation, which always errs on the side of being strict, silently ignoring errors is not a good idea by default.

There seems to be agreement to make this interpretation explicit in TOSCA 2.0, where we are focusing much more on building profiles and generally defining how "import" works more clearly and strictly.