diff options
author | Michael Scherer <misc@mageia.org> | 2011-03-22 17:26:58 +0000 |
---|---|---|
committer | Michael Scherer <misc@mageia.org> | 2011-03-22 17:26:58 +0000 |
commit | f61ed1c48282e7656cf2c030c1a2c7ff7152d293 (patch) | |
tree | 9fa24c7aaa3b8d1177c98bdc5474a5f52528bf9b /modules/stored_config | |
parent | 08fd1d27257602906a1a2c617cd7ea45d100d5af (diff) | |
download | puppet-f61ed1c48282e7656cf2c030c1a2c7ff7152d293.tar puppet-f61ed1c48282e7656cf2c030c1a2c7ff7152d293.tar.gz puppet-f61ed1c48282e7656cf2c030c1a2c7ff7152d293.tar.bz2 puppet-f61ed1c48282e7656cf2c030c1a2c7ff7152d293.tar.xz puppet-f61ed1c48282e7656cf2c030c1a2c7ff7152d293.zip |
function to get a list of exported types
Diffstat (limited to 'modules/stored_config')
-rw-r--r-- | modules/stored_config/lib/puppet/parser/functions/stored_config.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/modules/stored_config/lib/puppet/parser/functions/stored_config.rb b/modules/stored_config/lib/puppet/parser/functions/stored_config.rb new file mode 100644 index 00000000..c4993588 --- /dev/null +++ b/modules/stored_config/lib/puppet/parser/functions/stored_config.rb @@ -0,0 +1,19 @@ +require 'puppet/rails' + +# function : +# list_exported_ressources($resource) +# -> renvoie un array de title +# get_fact($node,$fact) +# -> renvoie le fact + +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 |