Replies: 2 comments
-
This is by design, at least for now. (No need to submit a test case.) Functions in TOSCA can be used in values, which means assignments of properties, attributes, parameters, inputs, and outputs. The use of functions is highly tied to TOSCA data types, and these are the only places in TOSCA which are typed in this way. Now, arbitrary keywords in TOSCA are also "typed", but these are YAML types, not TOSCA data types. For example, this We've discussed this issue in the TOSCA committee and the consensus, at least at the time, was that allowing these functions everywhere could open a can of worms. It's hard to follow through with the implications of this. For example, some keywords directly affect what is possible in other parts of the grammar. At the end of the day TOSCA is a fairly static language and does not really support parameterized graphs. Even requirement fulfillment is deterministic. Unfortunately the workaround for your use case may be passing TOSCA through a templating language (such as Jinja2). Another approach might be to attach several artifacts to the node template and then use a value (maybe an operation input) as a way of choosing which artifact to use. |
Beta Was this translation helpful? Give feedback.
-
And now I have that answer; your explanation makes perfect sense. Thanks a lot, |
Beta Was this translation helpful? Give feedback.
-
Before raising an issue, I'd like to check if this is even valid (I didn't find anything in the TOSCA document either allowing or forbidding, but maybe I didn't look had enough).
A colleague tried to use
get_property
as a way to assign the file corresponding to an artifact in a node, taking the file name from a property (on a different node)but puccini is not accepting that the file field may contain a tosca function and complains with:
topology_template.node_templates["node2"].artifacts["sw_image"].file: "map" instead of "string"
Is this a defect in puccini? Or does TOSCA limit the range of situations where TOSCA functions are accepted and therefore you cannot use get_property here?
P.S.: If you confirm that this is an issue, I'll ask my collegue to prepare a simplified test case and attach it to the issue.
TIA,
JPC
Beta Was this translation helpful? Give feedback.
All reactions