diff options
author | Luke Kanies <luke@madstop.com> | 2007-10-08 19:12:39 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2007-10-08 19:12:39 -0500 |
commit | d24c1ccc56b912e0ff69f7572dd36912c8c739c2 (patch) | |
tree | f86a02ae5845f1b7cb8327247356268a70e0948e /ext/module_puppet | |
parent | fc9c850414baff17dc97b0184f34e58b4bec5785 (diff) | |
download | puppet-d24c1ccc56b912e0ff69f7572dd36912c8c739c2.tar.gz puppet-d24c1ccc56b912e0ff69f7572dd36912c8c739c2.tar.xz puppet-d24c1ccc56b912e0ff69f7572dd36912c8c739c2.zip |
All tests should now pass again.
This is the first real pass towards using caching. The `puppet`
executable actually uses the indirection work, instead of
handlers and such (and man! is it cleaner).
Most of this work was a result of trying to get the client-side
story working, with correct yaml caching of configurations, which
means this commit also covers converting configurations to yaml,
which was a much bigger PITA than it needed to be.
I still need to write integration tests, and I also need to cover
the server-side story of a normal configuration retrieval.
Diffstat (limited to 'ext/module_puppet')
-rwxr-xr-x | ext/module_puppet | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/ext/module_puppet b/ext/module_puppet index 52f65b094..36efb4f0e 100755 --- a/ext/module_puppet +++ b/ext/module_puppet @@ -150,14 +150,23 @@ unless setdest Puppet::Util::Log.newdestination(:syslog) end -master[:Manifest] = ARGV.shift +Puppet[:manifest] = ARGV.shift unless ENV.include?("CFALLCLASSES") $stderr.puts "Cfengine classes must be passed to the module" exit(15) end -master[:UseNodes] = false +# Collect our facts. +Puppet::Node::Facts.terminus_class = :code +facts = Puppet::Node::Facts.find("me") +facts.name = facts.values["hostname"] + +# Create our Node +node = Puppet::Node.new(facts.name) + +# Merge in the facts. +node.merge(facts.values) classes = ENV["CFALLCLASSES"].split(":") @@ -166,32 +175,32 @@ if classes.empty? exit(16) end -master[:Classes] = classes +node.classes = classes begin - server = Puppet::Network::Handler.master.new(master) + # Compile our configuration + config = Puppet::Node::Configuration.find(node) rescue => detail - $stderr.puts detail - exit(1) -end - -begin - client = Puppet::Network::Client.master.new( - :Master => server, - :Cache => false - ) -rescue => detail - $stderr.puts detail + if Puppet[:trace] + puts detail.backtrace + end + if detail.is_a?(XMLRPC::FaultException) + $stderr.puts detail.message + else + $stderr.puts detail + end exit(1) end - if parseonly exit(0) end begin - config = client.getconfig + # Translate it to a RAL configuration + config = config.to_ral + + # And apply it config.apply rescue => detail Puppet.err detail |