$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