Issue #14893 has been reported by Michael Keller.

----------------------------------------
Feature #14893: eval function for puppet DSL as ruby function
https://projects.puppetlabs.com/issues/14893

Author: Michael Keller
Status: Unreviewed
Priority: Normal
Assignee: 
Category: API
Target version: 
Affected Puppet version: 
Keywords: 
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|

  Puppet::Parser::evaluate("if !defined(Setup::Virtualclass[#{args[0



-- 
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.

Reply via email to