This line here:
> content => template("samba/smb.erb", "samba/${hostname}.erb"),
What is your intention with having multiple .erb files per hostname? That might
help us figure if there a different solution is warranted.
-Rilindo
On Aug 7, 2013, at 3:20 PM, Ted Fiedler <[email protected]> wrote:
> I would like to check for the existence of a template file and if that
> template exists, use it otherwise move on. The file would obviously need to
> exist on the Puppet server, not the client. Here is my code.
>
> $filetest =
> File.exists?("/etc/puppetlabs/puppet/modules/samba/templates/$hostname.erb")
>
> if $filetest == "true" {
>
> file { '/etc/samba/smb.conf':
> notify => Service["smb", "winbind"],
> replace => 'no',
> path => '/etc/samba/smb.conf',
> ensure => file,
> content => template("samba/smb.erb",
> "samba/${hostname}.erb"),
> require => Package["samba"],
> }
> } else {
>
> file { '/etc/samba/smb.conf':
> notify => Service["smb", "winbind"],
> replace => 'no',
> path => '/etc/samba/smb.conf',
> ensure => file,
> content => template("samba/smb.erb"),
> require => Package["samba"],
> }
> }
>
>
> I keep getting the error:
>
> err: Could not retrieve catalog from remote server: Error 400 on SERVER:
> Syntax error at '.'; expected '}' at
> /etc/puppetlabs/puppet/modules/samba/manifests/init.pp:34 on node
>
>
> when I run the following test, it seems to work fine, but if I modify my code
> above within puppet to use this, it fails also...
>
> # cat test.rb
> $test =
> File.exists?("/etc/puppetlabs/puppet/modules/samba/templates/file.erb")
> print $test
> # ruby test.rb
> true
>
> Any ideas?
>
> A million thanks in advance
>
> Ted
>
> --
> 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 post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/puppet-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
--
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.