0

I have the following:

newrelic-debconf:
  debconf.set:
    - name: newrelic-php5
    - data:
        'newrelic-php5/application-name': { 'type': 'string', 'value': '{{ salt['pillar.get']('newrelic:applicationName', '') }}' }
        'newrelic-php5/license-key': { 'type': 'string', 'value': '{{ salt['pillar.get']('newrelic:licence', '') }}' }

it's pretty straightforward, using salt masterless provisioner with packer. However, this state fails with:

Rendering SLS 'base:newrelic' failed: Jinja syntax error: expected token 'end of print statement'%!(PACKER_COMMA) got 'string'; line 45

and then

'newrelic-php5/application-name': { 'type': 'string'%!(PACKER_COMMA) 'value': '{{ salt['pillar.get']('newrelic:applicationName'%!(PACKER_COMMA) '')' }} }    <======================

I'm not sure what the issue is: either it expects the first { to be something else OR the '{{ somehow escapes one curly brace. I do need the value to be between ' ' so what can I do?

Thanks!

  • I imagine error message come from Saltstack. I think maybe Packer is not doing what you think with your key/value. You can try to output it to a temp file to see what's inside. (Note: I use debconf.set with what seems the same syntax and it works (inside Packer too)) – daks Feb 22 '18 at 13:46

1 Answers1

0

The only differences I see with my own code are about white space.

Test removing some white spaces like this

'newrelic-php5/application-name': {'type': 'string','value': '{{ salt['pillar.get']('newrelic:applicationName', '') }}'}
daks
  • 673
  • 6
  • 23
  • I've accepted the answer, with a caveat: the issue was more about escaping. Once I've verified the white spaces, I noticed some escaped mismatches. – Andrei Dascalu Feb 28 '18 at 12:36