aboutsummaryrefslogtreecommitdiffstats
path: root/modules/stored_config/lib/puppet/parser/functions/list_exported_ressources.rb
blob: 4c7459a834235958538be20776bc1049d00079be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require 'puppet/rails'

# function :
#  list_exported_ressources($resource)
#    -> return a array of title

module Puppet::Parser::Functions
    newfunction(:list_exported_ressources, :type => :rvalue) do |args|
        exported_type = args[0]
        #TODO manage tags
        Puppet::Rails.connect()
        # TODO use find_each
        return Puppet::Rails::Resource.find(:all, 
                                            :conditions => { :exported => true, 
                                                             :restype => exported_type }).map { |r| r.title }
    end
end