Puppet

Puppet - 自定義函式 - 語句 - 錯誤 - “必須是語句的值……”

  • October 4, 2015

看起來很簡單…

# /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

但是根據puppet docs,我應該能夠按照書面方式進行呼叫。

這個簡單的 write_line_to_file 函式是語句函式的一個範例。它執行一個動作,並且不返回一個值。

我錯過了什麼?

CentOS:6.7 木偶大師:2.7.26

在一些面部護理之後,您似乎必須在對自定義函式進行每次更改後重新啟動 puppetmaster,即使在每次更改後更改都會發送給代理。

至少可以說是誤導。

引用自:https://serverfault.com/questions/726552