看起来很简单...
# /path/to/puppet/modules/custom/lib/puppet/parser/functions
module Puppet::Parser::Functions
newfunction(:release_check) do |args|
raise(Puppet::ParseError, "Testing!")
end
end
# /path/to/puppet/modules/mysql/manifests/install.pp
class mysql::install {
# Doesn't work
release_check(1)
# Does work, but I don't want anything returned making the assignment superfluous
$whocares = release_check(1)
}
但我一直收到这个错误:
err: Could not retrieve catalog from remote server: Error 400 on SERVER: Function 'release_check' must be the value of a statement at /etc/puppet/modules/mysql/manifests/install.pp:4 on node service-a-3
但根据木偶文档,我应该能够按照书面说明拨打电话。
这个简单的 write_line_to_file 函数是语句函数的一个示例。它执行操作,但不返回值。
我错过了什么?
CentOS:6.7 Puppetmaster:2.7.26
答案1
经过一番苦苦思索之后,似乎你必须在对自定义函数进行每次更改后重新启动 puppetmaster,尽管每次更改后都会将更改发送给代理。
误导至少可以说。