Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add a script to load a node data in a hash format for puppet 2.6

  • Loading branch information...
commit dca6f7d115aff6e8e85a78040ae414ec5c5e93df 1 parent e6819f7
R.I.Pienaar ripienaar authored

Showing 1 changed file with 13 additions and 0 deletions. Show diff stats Hide diff stats

  1. +13 0 agent/registration-mongodb/puppet/load_node.rb
13 agent/registration-mongodb/puppet/load_node.rb
... ... @@ -0,0 +1,13 @@
  1 +module Puppet::Parser::Functions
  2 + newfunction(:load_node, :type => :rvalue) do |args|
  3 + require 'puppet/util/mongoquery'
  4 +
  5 + results = Puppet::Util::MongoQuery.instance.find_nodes({"fqdn" => args[0]})
  6 +
  7 + if results.is_a?(Array)
  8 + return results.first
  9 + else
  10 + raise "Could not find a node matching #{args[0]}"
  11 + end
  12 + end
  13 +end

0 comments on commit dca6f7d

Please sign in to comment.
Something went wrong with that request. Please try again.