diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2005-09-23 20:42:08 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2005-09-23 20:42:08 +0000 |
| commit | 8211df036e1d2d24e1084616fc3fc4891b06cfdd (patch) | |
| tree | 597f8b999cf5210a7ceff5ef1e1977f1de08c241 /lib/puppet/client.rb | |
| parent | d20ac8e0b564e5413d571f2059de559e0783b72d (diff) | |
| download | puppet-8211df036e1d2d24e1084616fc3fc4891b06cfdd.tar.gz puppet-8211df036e1d2d24e1084616fc3fc4891b06cfdd.tar.xz puppet-8211df036e1d2d24e1084616fc3fc4891b06cfdd.zip | |
Many, many changes toward a completely functional system. The only current problems with my home config are that apache's stupid init script does not do status and that packages are not working as non-root users (which makes sense).
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@703 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/client.rb')
| -rw-r--r-- | lib/puppet/client.rb | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/lib/puppet/client.rb b/lib/puppet/client.rb index cbb7dbedc..9bc46717b 100644 --- a/lib/puppet/client.rb +++ b/lib/puppet/client.rb @@ -1,5 +1,3 @@ -#!/usr/local/bin/ruby -w - # the available clients require 'puppet' @@ -43,20 +41,26 @@ module Puppet method = ary[0] Puppet.info "Defining %s.%s" % [namespace, method] self.send(:define_method,method) { |*args| + Puppet.info "Calling %s" % method #Puppet.info "peer cert is %s" % @http.peer_cert #Puppet.info "cert is %s" % @http.cert begin call("%s.%s" % [namespace, method.to_s],*args) rescue OpenSSL::SSL::SSLError => detail - Puppet.err "Could not call %s.%s: Untrusted certificates" % - [namespace, method] + #Puppet.err "Could not call %s.%s: Untrusted certificates" % + # [namespace, method] raise NetworkClientError, "Certificates were not trusted" rescue XMLRPC::FaultException => detail - Puppet.err "Could not call %s.%s: %s" % - [namespace, method, detail.faultString] - raise NetworkClientError, - "XMLRPC Error: %s" % detail.faultString + #Puppet.err "Could not call %s.%s: %s" % + # [namespace, method, detail.faultString] + #raise NetworkClientError, + # "XMLRPC Error: %s" % detail.faultString + raise NetworkClientError, detail.faultString + rescue Errno::ECONNREFUSED => detail + msg = "Could not connect to %s on port %s" % [@host, @port] + #Puppet.err msg + raise NetworkClientError, msg #rescue => detail # Puppet.err "Could not call %s.%s: %s" % # [namespace, method, detail.inspect] @@ -78,7 +82,7 @@ module Puppet end def cert=(cert) - Puppet.info "Adding certificate" + Puppet.debug "Adding certificate" @http.cert = cert @http.verify_mode = OpenSSL::SSL::VERIFY_PEER end @@ -216,7 +220,7 @@ module Puppet def self.facts facts = {} Facter.each { |name,fact| - facts[name] = fact + facts[name] = fact.downcase } facts @@ -341,8 +345,8 @@ module Puppet if objects.is_a?(Puppet::TransBucket) @objects = objects else - Puppet.warning objects.inspect - raise NetworkClientError.new(objects.class) + raise NetworkClientError, + "Invalid returned objects of type %s" % objects.class end end end @@ -426,10 +430,11 @@ module Puppet begin @driver.send(method, *args) rescue XMLRPC::FaultException => detail - Puppet.err "Could not call %s.%s: %s" % - [namespace, method, detail.faultString] - raise NetworkClientError, - "XMLRPC Error: %s" % detail.faultString + #Puppet.err "Could not call %s.%s: %s" % + # [namespace, method, detail.faultString] + #raise NetworkClientError, + # "XMLRPC Error: %s" % detail.faultString + raise NetworkClientError, detail.faultString end } } |
