看起來很簡單...
# /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 木偶大師:2.7.26
答案1
經過一番摀臉之後,似乎在對自訂函數進行每次更改後都必須重新啟動 puppetmaster,儘管在每次更改後更改都會發送到代理程式。
誤導性的至少可以說。