summaryrefslogtreecommitdiffstats
path: root/lib/puppet/network/client/proxy.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/network/client/proxy.rb')
-rw-r--r--lib/puppet/network/client/proxy.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/puppet/network/client/proxy.rb b/lib/puppet/network/client/proxy.rb
new file mode 100644
index 000000000..e1295a96f
--- /dev/null
+++ b/lib/puppet/network/client/proxy.rb
@@ -0,0 +1,28 @@
+# unlike the other client classes (again, this design sucks) this class
+# is basically just a proxy class -- it calls its methods on the driver
+# and that's about it
+class Puppet::Network::Client::ProxyClient < Puppet::Network::Client
+ def self.mkmethods
+ interface = @handler.interface
+ namespace = interface.prefix
+
+
+ interface.methods.each { |ary|
+ method = ary[0]
+ Puppet.debug "%s: defining %s.%s" % [self, namespace, method]
+ define_method(method) { |*args|
+ 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
+ raise NetworkClientError, detail.faultString
+ end
+ }
+ }
+ end
+end
+
+# $Id$