Need help with Substitution/Transform syntax

Having some trouble determining the appropriate syntax when using dictionaries. The resulting output after substitution appears to be correct but transform appears to fail after that with “could not transform the file” error. System.Xml.XmlException: ‘DEVWEB’ is an unexpected token. Expecting white space. Line 25, position 57.

For example the dictionary variables:
ServiceHostServer[prdapp61].Name - DEVWEB
ServiceHostServer[prdapp61].Url - devwebserver
ServiceHostServerId - prdapp61

The transform:
<endpoint address="#{if Octopus.Machine.Name == “#ServiceHostServer[#{ServiceHostServerId}].Name}”}#{ServiceHostServer[#{ServiceHostServerId}].Url}#{/if}/Ltss.ServiceHost/WcfRequestProcessor.svc"
behaviorConfiguration=“defaultEndpointBehavior”
binding=“basicHttpBinding”
bindingConfiguration=“RequestProcessorBinding”
contract=“Agatha.Common.WCF.IWcfRequestProcessor”
name=“Agatha.Common.WCF.IWcfRequestProcessor” xdt:Transform=“SetAttributes” xdt:Locator=“Match(name)” />

Result after substitution
<endpoint address="#{if Octopus.Machine.Name == “DEVWEB”}devwebserver#{/if}/Ltss.ServiceHost/WcfRequestProcessor.svc"
behaviorConfiguration=“defaultEndpointBehavior”
binding=“basicHttpBinding”
bindingConfiguration=“RequestProcessorBinding”
contract=“Agatha.Common.WCF.IWcfRequestProcessor”
name=“Agatha.Common.WCF.IWcfRequestProcessor” xdt:Transform=“SetAttributes” xdt:Locator=“Match(name)” />

Hi Bill,

Thanks for getting in touch and providing all of that information! It looks like your syntax is spot on. I’ve tried it out in my local instance and I’m unable to reproduce the transform error you’re seeing. Would you be willing to provide the full transform file and the config file you’re trying to transform? I’d like to give this some additional testing using these same files to hopefully narrow down the cause. Feel free to mark this thread as private, or email us at support at octopus dot com if these files contain sensitive data.

I look forward to hearing back and getting to the bottom of this one!

Kind regards,

Kenny

Hi

I noticed the following subsequent to sending to support.
Variable Substitution Syntax

Complex Syntax
Additional conditional statements are supported in Octopus 3.5 and onwards, including == and !=.

The error is
‘DEVWEB’ is an unexpected token. Expecting white space. Line 25, position 57.

The result after substitution in prep for transformation is
<endpoint address="#{if Octopus.Machine.Name == “DEVWEB”}devwebserver#{/if}/Ltss.ServiceHost/WcfRequestProcessor.svc"

And the Octopus Deploy server is currently at version 3.2. So I suspect the newer syntax is likely the cause and the server it needs to be upgraded or above 3.5. If that doesn’t correct it I will send the full config and transform. Thanks for the prompt response.

I’ve upgraded the Octopus Deploy server to v2018.5.6 and the problem persists. I will be emailing transform and config files. Thanks

Hi Bill,

Thanks for emailing that information to help me better understand your scenario! I’m just letting you know here that I’ve emailed you back and we can continue the discussion there. :slight_smile:

Kind regards,

Kenny

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.