xlab-si / xopera-opera

xOpera orchestrator compliant with TOSCA YAML v1.3 in the making
https://xlab-si.github.io/xopera-docs/
Apache License 2.0
35 stars 14 forks source link

Derived_from not working as expected in xOpera 0.7.0 #258

Open R4pinho opened 1 year ago

R4pinho commented 1 year ago

Description

In xOpera version 0.7.0 the standard lifecycle interfaces are not working as expected in derived_from nodes. Let's say I have 2 node types derived from a parent node type. This 2 node types have different deployment steps but the undeployment process is the same, so I define the delete operation in the parent node type, but when I run opera undeploy nothing happens and the operation is not called.

This isn't a huge problem because the fix is very easy, but it was something that was working in previous versions and now doesn't work anymore.

anzoman commented 1 year ago

Hi @R4pinho and many thanks for opening this. Can you provide your full TOSCA template or CSAR just to be clearer?

R4pinho commented 1 year ago

Sorry @anzoman, I'm afraid I can't share the full TOSCA template due to the project I'm working on. However, this example ilustrates pretty well the problem. Let's say I have the definition of this node types:

node_types:
  node1:
    derived_from: tosca.nodes.Compute
    properties:
      a:
        type: string
        required: true
    interfaces:
      Standard:
        delete:
            inputs:
              a:  { value: { get_property: [ SELF, a ] }, type: string }
            implementation: playbooks/delete.yaml

  node2:
    derived_from: node1
    properties:
      b:
        type: string
        required: true
    interfaces:
      Standard:
        type: tosca.interfaces.node.lifecycle.Standard
        operations:
          create:
            inputs:
              a:  { value: { get_property: [ SELF, a ] }, type: string }
              b:  { value: { get_property: [ SELF, b ] }, type: string }
            implementation: playbooks/create1.yaml

  node3:
    derived_from: node1
    interfaces:
      Standard:
        type: tosca.interfaces.node.lifecycle.Standard
        operations:
          create:
            inputs:
              a:  { value: { get_property: [ SELF, a ] }, type: string }
            implementation: playbooks/create2.yaml

As you can see, node2 and node3 have different create operations, but share the same delete operation inherited from node1 and the a property. When I define the instantiation of node2 in node_templates I'm able to use opera deploy to create this node. However when I run opera undeploy the delete operation inherited from node1 is not called and the undeploy operation skips this node.