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

Inputs are not passed to Ansible playbooks using notify operation #256

Closed R4pinho closed 1 year ago

R4pinho commented 1 year ago

Description

I'm currently experiencing what I believe is a bug with opera notify operation, with inputs defined in a interface operation used by a trigger in a defined policy, not being passed to the corresponding Ansible playbook.

Steps

The following steps represent a simple example of what I'm trying to achieve.

Consider having the following node type definition:

example_node:
    derived_from: tosca.nodes.Compute
    properties:
      example:
        type: string
        required: true
    interfaces:
      Standard:
        type: tosca.interfaces.node.lifecycle.Standard
        operations:
          create:
            inputs:
              example:  { value: { get_property: [ SELF, example ] }, type: string }
            implementation: playbooks/create1.yaml
      example_interface:
        operations:
          create:
            inputs:
              example:  { value: { get_property: [ SELF, example ] }, type: string }
            implementation: playbooks/create2.yaml

With the following policy defition:

example_policy:
    derived_from: tosca.policies.Root
    targets: [ example_node ]
    triggers:
      example_trigger:
        event: example
        target_filter:
          node: example_node
        action:
          - call_operation: example_interface.create

Also consider that create2 Ansible playbook uses example input as a variable.

Current behaviour

The input example is not passed to the Ansible playbook, using command opera notify -e example -v, with the following output:

[Worker_0]     Executing create on example_0
***inputs***
[]
***inputs***

The following error is observed: The task includes an option with an undefined variable. The error was: 'example' is undefined. This behaviour is also observed if I try to define the inputs under call_operation in the policy definition. The only way to pass something to the Ansible playbook is using the -n argument with a file.

Expected behaviour

No error is returned and inputs can be used in Ansible playbooks.

anzoman commented 1 year ago

@R4pinho thanks for noticing this, the issue is related to our xOpera TOSCA parser and is happening because we override the inputs for operation called by trigger instead of updating them.

has been resolved on and is already available in a development version 0.1.3.dev1 of opera-tosca-parser Python package. We will release a new production version (0.2.0) this or next week and this will also be updated here in opera Python package (version 0.7.0)

anzoman commented 1 year ago

Resolved in 0.7.0.