Variable value cut off at underscore

Are there any known issues with characters allowed in variable values? For example, for a Powershell deploy script, we have an Octopus variable named TaskName. If the value is set to “SomeTask_Blah”, the script only sees both $TaskName and OctopusParameters[‘TaskName’] as being “SomeTask”, cut off at the underscore.

We’re a few versions behind at 2.5.7.384, but I did not see anything that seemed to be related when perusing the changelogs for all later versions.

Is there a workaround for this?

Hi Nick,

Thanks for getting in touch! I can’t replicate this and I haven’t heard of any issues around characters in the values unless its a # key in rare instances.
See my screenshots. Can you provide the snippet of code and the value? I am wondering if it is a PowerShell thing or a special reserved word or some really obscure thing we might be able to track down.

Vanessa

underscore-var-var.PNG

Vanessa,

Thank you for the response. Is it possible that were not able to replicate this due to it just having been fixed in a newer version and maybe not explicitly mentioned in a changelog? If it’s not an issue with the current version, that gives us more reason to upgrade.

TaskName parameter value is set to SomeTask_Blah. (This is not the actual value we are using, but the actual value consists of all uppercase and lowercase alphabetic characters, aside from the one underscore). The PowerShell version is 4.0 at the deploy destination. To confirm the results before reporting, I added a couple of debug lines to the top of the script. Similar to the following is shown:

Write-Output "Var in params = "$($OctopusParameters['TaskName'])“”

Write-Output "Var direct = "$TaskName“”

Var in params = “SomeTask”

Var direct = “SomeTask”

My workaround for now is going to just be just renaming the task that I need to work with, but in case this was a known issue with known fixed version or workaround, or if it wasn’t a known issue, I wanted to get it reported.

Scratch all of that. I was missing the extremely obvious.

Within the Variables section of the project, a TaskName var was entered with the value of “SomeTask”. That was unintended and forgotten about. It was overriding the parameter value.

Sorry for the bit of wasted time.

From: Nick Hastings [mailto:nick.hastings@thekag.com]
Sent: Wednesday, May 20, 2015 7:40 AM
To: 'Vanessa Love’
Subject: RE: Variable value cut off at underscore [Problems #34219]

Vanessa,

Thank you for the response. Is it possible that were not able to replicate this due to it just having been fixed in a newer version and maybe not explicitly mentioned in a changelog? If it’s not an issue with the current version, that gives us more reason to upgrade.

TaskName parameter value is set to SomeTask_Blah. (This is not the actual value we are using, but the actual value consists of all uppercase and lowercase alphabetic characters, aside from the one underscore). The PowerShell version is 4.0 at the deploy destination. To confirm the results before reporting, I added a couple of debug lines to the top of the script. Similar to the following is shown:

Write-Output "Var in params = "$($OctopusParameters['TaskName'])“”

Write-Output "Var direct = "$TaskName“”

Var in params = “SomeTask”

Var direct = “SomeTask”

My workaround for now is going to just be just renaming the task that I need to work with, but in case this was a known issue with known fixed version or workaround, or if it wasn’t a known issue, I wanted to get it reported.