On Wednesday, April 16, 2014 8:01:13 AM UTC-5, Laurent CREPET wrote:
>
> Hi,
>
> I'm new to Puppet. I'm using Puppet 3.4.3. I'm trying tried to build a 
> template of file /etc/my.cnf. Puppet does not like the square brackets in 
> my.cnf.erb, giving the following error:
>     Error: Parameter source failed on File[/etc/my.cnf]: Could not 
> understand source [mysqld]
>
> I will have a look at the Puppet Forge for modules to deal with MySQL. 
> However, can we have a square bracket in a template (outside of the 
> "Out-of-Scope Variables" use) ?
>
>

To the best of my knowledge, square brackets appearing in ERB template text 
have no special meaning to ERB.  They are just copied verbatim to the 
output.

I suspect that you have written something like

file { '/etc/my.cnf'':
  source => template('my.cnf.erb')
}

where what you want is

file { '/etc/my.cnf'':
  content => template('my.cnf.erb')
}

The distinction is quite important: the 'source' parameter is expected to 
specify a URL from which the agent get retrieve the desired file content, 
whereas the 'content' property gives the content itself.  (The two are 
mutually exclusive.)


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/42caaaac-eea7-4da3-89ee-da1913ddd3c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to