我试图在接收新服务器时自动执行一些任务。 首先是添加一些yum回购。
我的/etc/puppet/modules/repo/manifests/init.pp :
1 class repo { 2 file { "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL": 3 owner => root, 4 group => root, 5 mode => 0644, 6 source => "puppet:///repo/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL" 7 } 8 9 yumrepo { 10 "epel": 11 descr => 'the epel repo', 12 mirrorlist => 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch', 13 enable => 1, 14 gpgcheck => 1, 15 gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL", 16 require => File["/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL"] 17 } 18 }
语法确定与puppet parser validate时检查。
但是当连接木偶代理时我得到了下面的错误:
# puppet agent --no-daemonize --verbose notice: Starting Puppet client version 2.7.1 err: Could not retrieve catalog from remote server: Error 400 on SERVER: Invalid parameter enable at /etc/puppet/modules/repo/manifests/init.pp:17 on node svr051-4170 notice: Using cached catalog err: Could not retrieve catalog; skipping run notice: Caught INT; calling stop
正如你所看到的,第17行是紧密的大括号。 我真的不明白是什么问题。 任何帮助将不胜感激。
“启用”实际上并不是yumrepo资源的有效参数。 它被称为“enable_d_”。
它在花括号上窒息的原因是它是该部分的结尾。 我不知道Puppet如何parsing文件的私密细节,但是我的猜测是Puppet在parsing过程中抓取了所有参数,并将它们一起处理,所以在parsing器离开部分之前它不知道有什么问题。
很快就会猜到这是与在镜像列表中的$或&有关的事情,试着在它们前面添加\看看会发生什么