Range support (v1.1.0-beta.1) issue dynamic loop #502
Unanswered
WilliamDeKeyzer
asked this question in
Q&A
Replies: 1 comment
-
Update: current workaround we have is our own Python custom scripts around venom, which will trigger venom at various steps with only the correct data. It will then continue looping with the new vars to generate new YAML files to do subsequent venom runs, etc etc, recursively. However it feels like this should be possible natively in venom and be part of the 'range' addendum instead of a lengthy workaround |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a question related to the newly added range functionality which allows you to loop over variables.
Since I am using it the POST requests to an endpoint which creates objects, every subsequent request will need the new random-generated-ids of previous requests to continue.
Sinec all of this has to be dynamic, my input data for model A (making the example simple) looks something like this:
As:
- name: Test-a-1
- name: Test-a-2
so the first loop will take the As as inpput and loop, and create actual database objects As with random IDs which I fetch and store in my variables. in the variables this will be accessible like this:
{{.cached_a_data.cached_a_data0.id}}
{{.cached_a_data.cached_a_data1.id}}
now I want to have input objects Bs that reference certain As, so not every B is assigned statically to the same object A - and I cannot hardcode the ids inside my input yaml since they are unknown up front:
Bs:
- name: Test-b-1
aRef: 0
- name: Test-b-2
aRef: 1
So based on the 'aRef' field I would want to access a certain index of the array in my variables inside a range-loop of the Bs data:
{{.cached_a_data.cached_a_data{{.value.aRef}}.id}}
{{.cached_a_data.cached_a_data{{.value.aRef}}.id}}
but this is not parseable (variable within variable) and leads to the following error:
template: input:40: bad character U+007B '{'
What am I doing wrong or how is it possible to reference other variables (index) inside a variable, inside the new 'range' construct?
Beta Was this translation helpful? Give feedback.
All reactions