Sorry, the code for the custom function is:

Puppet::Parser::Functions::newfunction(:debug_msg, :type => :statement, :doc => "
Send messages to a particular debug level
") do |vals|

 $level, $code_to_execute = vals
$possible_levels = ["debug","info","notice","warning","err","alert","emerg","crit"]
 if $possible_levels.include? $level
 else
raise(ArgumentError, 'Must specify proper debug type. It can be either "debug","info","notice","warning","err","alert","emerg" or "crit" ')
 end
$dummy = function_inline_template("<% " + "Puppet." + $level + "(\"" + $code_to_execute + "\")" + "%>")
end

On Fri 16 Nov 2012 10:46:38 PM IST, Abhijeet R wrote:
Hi,

I created a custom function named debug_msg() which could used to send
different kind of debug messages straight from the manifest.
It can be used something like:

debug_msg("notice","NOTICE message")
debug_msg("debug", "Send as a debug message")

More information can  be found here:
http://blog.abhijeetr.com/2012/11/execute-ruby-code-from-within-puppet.html


Shouldn't this be included in the standard puppet? Or if it's helpful,
why isn't it already included? Or is it already there and it's just
that I don't know it?


--
Cheers,
Abhijeet R
http://blog.abhijeetr.com

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to