-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
Having a custom workflow defined, which triggers a rest call operation, it's not possible to store responses from other rest calls than the first one (from first workflow execution).
There is no trace of next calls at all in runtime properties. Please see the code and runtime properties after triggering the workflow three times with values 1, 2, 3 respectively:
tosca_definitions_version: cloudify_dsl_1_3
imports:
- https://cloudify.co/spec/cloudify/6.2.0/types.yaml
- plugin:cloudify-utilities-plugin
node_types:
issue.nodes.Issue:
derived_from: cloudify.rest.Requests
properties:
hosts:
default:
- 192.168.0.136
port:
default: 5000
ssl:
default: false
verify:
default: false
interfaces:
custom:
increment_call_nr:
executor: central_deployment_agent
implementation: scripts/increment_call_nr.py
make_rest:
implementation: rest.cloudify_rest.tasks.execute
inputs:
template_file:
default: templates/echo.yaml
prerender:
default: True
save_path:
default: { concat: [ save_path_, { get_attribute: [ SELF, call_nr ] } ] }
params:
default:
call_nr: { get_attribute: [ SELF, call_nr ] }
workflow_value: { get_attribute: [ SELF, workflow_value ] }
print_runtime:
executor: central_deployment_agent
implementation: scripts/print_runtime.py
node_templates:
rest_node:
type: issue.nodes.Issue
workflows:
make_rest:
mapping: cloudify_custom_workflow.cloudify_custom_workflow.tasks.customwf
parameters:
nodes_to_runon:
default: [ rest_node ]
operations_to_execute:
default:
- custom.increment_call_nr
- custom.make_rest
workflow_value:
type: integerscripts/increment_call_nr.py
props = ctx.instance.runtime_properties
props.setdefault('call_nr', 0)
props['call_nr'] += 1
props['workflow_value'] = inputs['workflow_value']
props.setdefault('calls_nrs', []).append(props['call_nr'])
props.setdefault('workflow_values', []).append(props['workflow_value'])templates/echo.yaml
rest_calls:
- path: /echo
method: POST
headers:
Content-type: application/json
Accept: application/json
payload:
call_nr: {{ call_nr }}
workflow_value: {{ workflow_value }}
response_format: json
response_translation: [ "save_key_{{ call_nr }}" ]
runtime properties:
{
"_finished_operations": {
"cloudify.interfaces.lifecycle.create": true,
"cloudify.interfaces.lifecycle.configure": true,
"cloudify.interfaces.lifecycle.start": true,
"custom.make_rest": true
},
"call_nr": 3,
"workflow_value": 3,
"calls_nrs": [
1,
2,
3
],
"workflow_values": [
1,
2,
3
],
"save_path_1": {
"result_properties": {
"save_key_1": {
"call_nr": 1,
"workflow_value": 1
}
},
"calls": [
{
"path": "/echo",
"method": "POST",
"headers": {
"Content-type": "application/json",
"Accept": "application/json"
},
"payload": {
"call_nr": 1,
"workflow_value": 1
},
"response_format": "json",
"response_translation": []
}
]
}
}Metadata
Metadata
Assignees
Labels
No labels