Can't make nested #each statements work in variable substitution

Hi all, running Octopus 3.2.0.

I am trying to make the following work:

#{each monitor in Monitors}
<#{monitor[Name]} ip="#{monitor[TargetIp]}" port="#{monitor[TargetPort]}" sendData="#{monitor[SendData]}">

#{each filter in monitor[Filters]}
#{/each}

</#{monitor[Name]}>
#{/each}

This works very well on the top level #each statement, but my inner #each statement kind of broken.

It echoes only 1 line with value []

The rest of the substitution later in the file works so I assume that it’s not a problem directly linked to nesting #each statements.

Here is a sample of my variables values:


Monitors[SomeSettings][Filters][0].ExtractClient value
Monitors[SomeSettings][Filters][0].ExtractProcess value
Monitors[SomeSettings][Filters][0].Filter value
Monitors[SomeSettings][Filters][1].ExtractClient empty
Monitors[SomeSettings][Filters][1].ExtractProcess value
Monitors[SomeSettings][Filters][1].Filter value
Monitors[SomeSettings][Name] SomeSettings
Monitors[SomeSettings][ProcessMonitorSettingsType] true

FYI:
Trying the following make the complete substitution fail

#{each monitor in Monitors}

#{each filter in Monitors[monitor[Name]][Filters]}

Hi Arnaud,

Thanks for getting in touch, I’ll try to reproduce this today/add some test cases and will get back to you.

Paul Stovell

I am not in the office for the moment, returning on Monday 1st of Feb.

Hi Paul, did you manage to reproduce this?

Hi Arnaud,

I’m taking over the issue for Paul and I tried to reproduce the issue and saw a similar behaviour (i.e. the variables are echo’d as it cannot resolve them). Unfortunately, the data structure is a bit beyond the supported scenarios. Nested #{each} statements are supported so that’s not the problem.

The best source of information to see what is supported is the documentation page (though I assume you’ve already seen it) as well as the unit tests against the component that powers the variable substitution.

I’d suggest reviewing the tests and looking at if you can restructure your data to produce the same output.

Let me know how you go.

Rob

Hi, thanks for the feedback.

I didn’t check the test-case myself, but now it makes more sense.

Too bad for me I suppose. I’ll have to find another way to express my configuration.

I don’t really get why my data-structure should not be supported though, in the end it’s only array variables accesses through references and there is no way to introduce a recursive loop so…

Hi Arnaud,

Thanks for the reply. The component that powers this feature is open source so if you’re interested, I’d suggest exploring it a bit more. I tried numerous variations in the UsageFixture to try to get this working but I wasn’t able to do so. If you find something I’ve missed or have an enhancement, please let me know or submit a pull request to the Github repository.

Rob