我已经检查了官方木偶documentation并且语法看起来很好,但我仍然遇到语法错误。 有人可以检查问题是什么吗?
我正在使用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,
}
}
}
错误:无法从远程服务器检索目录:SERVER上的错误400:'=='处的语法错误;在节点上的/etc/puppet/modules/puppet/manifests/init.pp:6预期'}'
答案 0 :(得分:2)
Puppet DSL中没有elseif
条件。您需要改为elsif
。有关详细信息,请查看此处的文档:https://docs.puppet.com/puppet/3.8/lang_conditional.html#syntax。