Help combining two maps based on map name #2084
Answered
by
mikefarah
glitchcrab
asked this question in
Q&A
-
I have the following data structure, whereby each entry under
I have tried and failed at the following; I would like to write a command to iterate over each nodePool, look up its class and then duplicate the keys from the class into the nodePool. The aim is to end up with the following:
Could anyone help me out with this please? |
Beta Was this translation helpful? Give feedback.
Answered by
mikefarah
Jun 29, 2024
Replies: 1 comment 1 reply
-
Short Answer:
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
glitchcrab
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Short Answer:
$nodeClasses
. We'll need this because we are going to update each of the nodePools relative to themselves (and so the.
operator will refer to the specific node pool).*
is the merge operator, we could do `.nodePools[] |= . * ($nodeClasses | .[.class])' but we can instead use the update shorthand:*=n
doc is a relative merge operator we can use to do exactly that.n
tells it only to merge in "new" values (so if someone specifies a "diskGiB" for…