summaryrefslogtreecommitdiffstats
path: root/lib/puppet/node_source/external.rb
diff options
context:
space:
mode:
authorMichael V. O'Brien <michael@reductivelabs.com>2007-09-25 17:23:36 -0500
committerMichael V. O'Brien <michael@reductivelabs.com>2007-09-25 17:23:36 -0500
commit93f64885100eecb4c235d08e1f9cd266e6d789ad (patch)
treea5ab7d8236ffc84ef05124d03c1cb9db89baf4a9 /lib/puppet/node_source/external.rb
parentdf1879b814c25cd3564abaa3064e0cdd6ef50eb4 (diff)
parentfa643e61c7451c2c46623d2c801a42c6c7640e1e (diff)
downloadpuppet-93f64885100eecb4c235d08e1f9cd266e6d789ad.tar.gz
puppet-93f64885100eecb4c235d08e1f9cd266e6d789ad.tar.xz
puppet-93f64885100eecb4c235d08e1f9cd266e6d789ad.zip
Merge branch 'master' of git://reductivelabs.com/puppet
Diffstat (limited to 'lib/puppet/node_source/external.rb')
-rw-r--r--lib/puppet/node_source/external.rb51
1 files changed, 0 insertions, 51 deletions
diff --git a/lib/puppet/node_source/external.rb b/lib/puppet/node_source/external.rb
deleted file mode 100644
index 54111d924..000000000
--- a/lib/puppet/node_source/external.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-Puppet::Network::Handler::Node.newnode_source(:external, :fact_merge => true) do
- desc "Call an external program to get node information."
-
- include Puppet::Util
- # Look for external node definitions.
- def nodesearch(name)
- return nil unless Puppet[:external_nodes] != "none"
-
- # This is a very cheap way to do this, since it will break on
- # commands that have spaces in the arguments. But it's good
- # enough for most cases.
- external_node_command = Puppet[:external_nodes].split
- external_node_command << name
- begin
- output = Puppet::Util.execute(external_node_command)
- rescue Puppet::ExecutionFailure => detail
- if $?.exitstatus == 1
- return nil
- else
- Puppet.err "Could not retrieve external node information for %s: %s" % [name, detail]
- end
- return nil
- end
-
- if output =~ /\A\s*\Z/ # all whitespace
- Puppet.debug "Empty response for %s from external node source" % name
- return nil
- end
-
- begin
- result = YAML.load(output).inject({}) { |hash, data| hash[symbolize(data[0])] = data[1]; hash }
- rescue => detail
- raise Puppet::Error, "Could not load external node results for %s: %s" % [name, detail]
- end
-
- node = newnode(name)
- set = false
- [:parameters, :classes].each do |param|
- if value = result[param]
- node.send(param.to_s + "=", value)
- set = true
- end
- end
-
- if set
- return node
- else
- return nil
- end
- end
-end