Attribute driven templates

Scenario : Dependent on an attribute variable I want additional text blocks to be put into a configuration file.

Using Chef Server 12 and Windows Client 12.15.19

I have found answers link but have been unable to get it to work.

Current code :

attribute

default['application']['patch'] = true

Template code:

Existing text in template

<% If node['application']['patch'] -%>

THIS IS THE TEXT BELOW I WANT TO ADD

<policyEntry queue="TESTING" producerFlowControl="true" memoryLimit="20mb">
	<deadLetterStrategy>
		<individualDeadLetterStrategy queuePrefix="READY." useQueueForQueueMessages="true" processExpired="true" 		processNonPersistent="true"/>
	</deadLetterStrategy>
</policyEntry>

END OF TEXT

<% End -%>

Existing text in template

The knife upload works ok but on run I get an error about an unexpected if

Its probably a simple mistake but any help would be appreciated.

In theory the code looks alright, it would be more helpful to see the error.

Is the If capitalized in code? If so, try making it lower case.

In my code I was missing the dash at the end of the first line starting

<% If node['application']['patch'] -%>

I had

<% If node['application']['patch'] %>

Ironically I typed it correctly when posting the question. Apologies :grinning:

Thank you Chris and Alex for taking a look.