Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expected behaviour for template containing text like #{$Foo}? #5

Closed
jasonmitchell opened this issue Feb 26, 2016 · 3 comments
Closed
Assignees

Comments

@jasonmitchell
Copy link

I encountered an issue when transforming a file in Octopus Deploy where a piece of text in the file in the format of #{$Foo} caused the error:

Parsing failure: unexpected '#'; expected end of input (Line 1, Column 1); recently consumed:

I am not trying to substitute this piece of text it just happens to be in file being transformed. I've added a test case as an example:

https://github.com/jasonmitchell/Octostache/commit/018e6c609cc5f4f5e082215b4039d15a448faf74

The error message for this test is the same as the other cases for the test. I wanted to clarify if this is expected behaviour or is a bug in the template parser?

If this is expected is there anyway to work around other than removing the piece of text from the file?

@zentron zentron self-assigned this Mar 2, 2016
@mattsalmon
Copy link

I've also had this same issue - surprised there's nobody else encountered this scenario!

@gurufordy
Copy link

I also get this issue when running the DACPAC deploy community library script as below

https://library.octopusdeploy.com/step-template/actiontemplate-sql-deploy-dacpac

It has the following code:

`Function Format-OctopusArgument {

Param(
	[string]$Value
)

$Value = $Value.Trim()

# There must be a better way to do this
Switch -Wildcard ($Value){

	"True" { Return $True }
	"False" { Return $False }
	"#{*}" { Return $null }
	Default { Return $Value }
}

}`

@zentron
Copy link
Contributor

zentron commented Nov 30, 2016

Hi guys, this issue is because Octostache sees #{ and thinks you are asking for a variable replacement. To avoid this issue, add another # before it (e.g. "##{*}" { Return $null }) and when variable replacement takes place, Octostache will remove the extra # leaving you with the value you are after.
I have updated our docs outlining this behaviour.
I hope that helps!

@zentron zentron closed this as completed Nov 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants