Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to make my own function. I keep getting this message.

err: Could not retrieve catalog from remote server: Error 400 on SERVER: Function 'brent_k' does not return a value at /etc/puppet/modules/munin/manifests/init.pp:17 on node XYZ.com

Here is my simple code

xyz.com:/etc/puppet/modules/munin/lib/puppet/parser/functions# cat brent_k.rb
  module Puppet::Parser::Functions
    newfunction(:brent_k, :type => :rvalue) do |args|
      val = 'ok'
      val
    end
  end

And then in my manifest, I have

$a = brent_k()

I tried return val too. How can I fix this?

share|improve this question
3  
You may wish to accept some previous questions to ensure you get a good response. –  Alastair McCormack Oct 18 '12 at 12:18
    
K I found the answer. It appears puppet does some caching. So first I added 'ignorecache = true' to puppet.conf. But then I found that thats for the client caching. I then found that if I keep restarted puppetmaster, then I my dev env, I can see my changes / test. –  Brent Oct 18 '12 at 13:41
add comment

1 Answer

When you change any custom ruby code, such as a custom function, you must restart the Puppetmaster. If you are running puppet under passenger, this means restarting Apache. Otherwise, you'll get the old version.

In addition, there is a rather nasty bug that kicks in if you are hosting multiple environments in your puppetmaster with an identically named function in the other environment. In this case, you have no way to be sure which environment's function is used when you call the function name! It uses the same function namespace across all environments... (this is confirmed to happen in Puppet 2.7.22, not sure about 3.x)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.