Issue #14894 has been updated by Kelsey Hightower. Status changed from Unreviewed to Needs Decision Assignee set to Pieter van de Bruggen Keywords changed from eval to eval dsl
Michael Keller, Thanks for submitting this feature request. I think we should be this up for consideration. Pieter, Can you look at this? ---------------------------------------- Feature #14894: eval function for puppet DSL as ruby function https://projects.puppetlabs.com/issues/14894#change-64727 Author: Michael Keller Status: Needs Decision Priority: Normal Assignee: Pieter van de Bruggen Category: API Target version: Affected Puppet version: Keywords: eval dsl Branch: it would be super to have a ruby function which "evaluates" puppet DSL code. that way the knowledge of the inner workings of puppet isn't required to write some "macros". Example (untested code - might be working or not): ` Puppet::Parser::Functions::newfunction(:setup_virtualclass, :doc => 'write stuff here') do |args| Puppet::Parser::Functions.autoloader.loadall args.flatten.each do |classname| next if function_defined("Setup::Virtualclass[#{classname}]") function_realize("Setup::Virtualclass[#{classname}]") end end ` could be written as: ` Puppet::Parser::Functions::newfunction(:setup_virtualclass, :doc => 'write stuff here') do |args| classname = args[0] Puppet::Parser::evaluate("if !defined(Setup::Virtualclass[#{classname}]) { @setup::virtualclass { #{classname}: } }") end ` -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
