Reputation: 251
I've checked official puppet documentation on this and the syntax looks fine, but I still get a syntax error. Can someone please check what the problem is?
I am using puppet server 3.8.
class puppet {
if $puppet_conf == 'default' {
}
elseif $puppet_conf == undef {
file { '/etc/puppet/puppet.conf':
ensure => present,
owner => "root",
group => "root",
mode => "644",
source => "puppet:///modules/puppet/puppet.conf}",
notify => Exec['puppet-restart'],
}
exec { 'puppet-restart':
command => '/usr/bin/touch /tmp/.puppet-restart',
refreshonly => true,
}
}
else {
file { '/etc/puppet/puppet.conf':
ensure => present,
owner => "root",
group => "root",
mode => "644",
source => "puppet:///modules/puppet/${puppet_conf}",
notify => Exec['puppet-restart'],
}
exec { 'puppet-restart':
command => '/usr/bin/touch /tmp/.puppet-restart',
refreshonly => true,
}
}
}
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Syntax error at '=='; expected '}' at /etc/puppet/modules/puppet/manifests/init.pp:6 on node
Upvotes: 1
Views: 1939
Reputation: 28739
There is no elseif
conditional in Puppet DSL. You need to put elsif
instead. Check the documentation here for more information: https://docs.puppet.com/puppet/3.8/lang_conditional.html#syntax.
Upvotes: 2