tliron / puccini

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

Support Triggers #29

Closed pmjordan closed 4 years ago

pmjordan commented 4 years ago

Could you please do the work to add to validate triggers?

TOSCA 1.3 section 3.6.22.1 says that event is a required and event_name is a string, but in v0.12.0, if I add a trigger to examples/tosca/policies-and-groups.yml like this:

  ContinuousBackup:
    derived_from: Backup
    # Properties are how you configure the policy
    properties:
      frequency:
        type:
          scalar-unit.time
    # Targets are inherited
    triggers:
      event: MyEventName

Then puccini gives an error of

@27,7 policy_types["ContinuousBackup"].triggers["event"]: "!!str" instead of "!!map"
tliron commented 4 years ago

There are two issues here:

Your notation is incorrect, I think. If you look at 3.7.12.1 you'll see that triggers has to be a map of trigger definitions. And then in 3.6.22.3.1 and 3.6.22.3.2 you'll see that there is no string notation. So you have to write:

  ContinuousBackup:
    derived_from: Backup
    triggers:
      mytrigger:
        event: MyEventName

But, a second issue is that TOSCA 1.3 changed the event_type keyword to be event. I will fix this.

tliron commented 4 years ago

Actually, the usage of action also changed between TOSCA 1.2 and TOSCA 1.3. This requires a whole re-implementation.