Issue #14894 has been updated by Pieter van de Bruggen.
I'm curious about your use case. Is there a reason you couldn't do this in the Puppet DSL with a defined type? I see iteration in your example; could you achieve the same results with array expansion? ---------------------------------------- Feature #14894: eval function for puppet DSL as ruby function https://projects.puppetlabs.com/issues/14894#change-64803 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.
