Parent Directory | Revision Log
add a function to fetch stored fact from the db
1 | misc | 1351 | require 'puppet/rails' |
2 | |||
3 | # get_fact($node,$fact) | ||
4 | # -> return the fact, from stored config | ||
5 | |||
6 | module Puppet::Parser::Functions | ||
7 | newfunction(:get_fact, :type => :rvalue) do |args| | ||
8 | node = args[0] | ||
9 | fact = args[1] | ||
10 | |||
11 | Puppet::Rails.connect() | ||
12 | return Puppet::Rails::FactValue.find( :first, | ||
13 | :joins => [ :host, :fact_name ], | ||
14 | :conditions => { :fact_names => {:name => fact }, | ||
15 | :hosts => {:name => node }} | ||
16 | ).value | ||
17 | end | ||
18 | end |
ViewVC Help | |
Powered by ViewVC 1.1.30 |