1

Seems simple enough...

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

But I keep getting this error:

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

But according to the puppet docs, I should be able to make that call as written.

This simple write_line_to_file function is an example of a statement function. It performs an action, and does not return a value.

What am I missing?

CentOS: 6.7 Puppetmaster: 2.7.26

Mike Purcell
  • 1,708
  • 7
  • 32
  • 54
  • 1
    Which version are you running? Is the function maybe cached on the master after you changed it? I tried running the exact same function code and it works for me. – faker Oct 04 '15 at 08:13
  • @faker: Not sure if cached or if it has to be restarted after every change to a custom function, but it was indeed a restart of the puppetmaster that fixed the prob. – Mike Purcell Oct 04 '15 at 16:38

1 Answers1

2

After some facepalming, it seems you have to restart the puppetmaster after EVERY change you make to a custom function, even though, the changes are sent to the agent, after EVERY change.

Misleading to say the least.

Mike Purcell
  • 1,708
  • 7
  • 32
  • 54