かなり簡単そうです...
# /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
少し顔を覆った後、カスタム関数に変更を加えるたびに、その変更がエージェントに送信されているにもかかわらず、パペットマスターを再起動する必要があるようです。
誤解を招く控えめに言っても。