Ask Your Question

How to escape special characters in template

asked 2013-10-23 14:12:36 -0500

spuder gravatar image

updated 2013-10-23 14:16:28 -0500

I've got a file that needs the following content verbatim (the $ should be in the file, not interpreted).

$pbsserver foo.localdomain

I've made a template like so

\$pbsserver <%= @fqdn %>

Yet, when I apply the manifest, I receive the following error

Error: Parameter source failed on File[/var/spool/torque/mom_priv/config]: Cannot use relative URLs '$pbsserver' at /etc/puppet/modules/alps/manifests/torque.pp:31
Wrapped exception:
Cannot use relative URLs '$pbsserver'

How can I convince puppet that the $pbsserver text is not a variable, nor is it a relative url?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-10-23 14:24:30 -0500

spuder gravatar image

As pointed out by _rc in the irc channel, the problem is not with the character escape.

The puppet resource had the following syntax.

file { 'foo':
  ensure = file,
  source => template('foo/bar.erb')

source is only valid for files, not templates, Changing the type from source to content fixed the issue.

file { 'foo':
  ensure = file,
  content => template('foo/bar.erb')
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-10-23 14:12:36 -0500

Seen: 3,554 times

Last updated: Oct 23 '13