Access Relationship properties in Cloudify plugin 3.1

128 Views Asked by At

I have used the plugin template to create a simple test plugin for cloudify 3.1. my plugin.yaml has the following description for a relationship:

relationships:
  mytest.relationships.connected_to:
    derived_from: cloudify.relationships.connected_to
    source_interfaces:
      cloudify.interfaces.relationship_lifecycle:
        establish:
          implementation: python_webserver.plugin.services.publish
          inputs:
            publish_input: 
              default: {}
    properties:
      publish_propety: 
        default: {}

I have two questions:

  1. How can I read the relationship properties (“publish_propety” for instance”) inside the publish function (which implement the establish interface). I did not find any way to access them. The ctx has references for source and target nodes and instances , but I did not find anything related to relationship
  2. What is the different between property and input for relationship? And when should we use each of them?

Thanks

1

There are 1 best solutions below

0
On
  1. You can't get the relationship properties with ctx you could try to get to it with a rest call but it would be messy. You could however move "publish_propety []" to "publish_input []" and than you can get to it.
  2. The way I see it, properties are what describe your instance, you will probably use them for instance image,zone... Inputs will be more dynamic, you could use them to define things on creation but dynamically or even at runtime. You could switch between the two,it is a matter of how you define your software model.