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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Aren''t all of these functions already available? http://docs.puppetlabs.com/references/latest/function.html Rajul On Friday, November 16, 2012 9:22:57 AM UTC-8, Abhijeet Rastogi wrote:> > 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 > http://docs.puppetlabs.com/references/latest/function.html >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/-t69u_QMC_gJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Abhijeet R
2012-Nov-16 17:41 UTC
Re: [Puppet Users] Re: Sending debug messages from manifests
Oh, for some reason, I missed that. They are already available. I am new to puppet. I should really read all the reference before doing things myself. Sorry for the trouble guys. I wish I could delete the irrelevant post but this is a ML. :( On Fri 16 Nov 2012 11:06:49 PM IST, Rajul Vora wrote:> Aren''t all of these functions already available? > > http://docs.puppetlabs.com/references/latest/function.html > > Rajul-- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.