summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrcritten@redhat.com <rcritten@redhat.com>2007-09-26 16:31:43 -0400
committerrcritten@redhat.com <rcritten@redhat.com>2007-09-26 16:31:43 -0400
commitf8eda3da3e4cf7053947d365219e82fa7079b9cf (patch)
treeef47b1594ab4bb82644dfeea23631cf008dc0113
parent1a7ef0d1354b94ae6bd3acf5a9c29090742f56b9 (diff)
downloadfreeipa-f8eda3da3e4cf7053947d365219e82fa7079b9cf.tar.gz
freeipa-f8eda3da3e4cf7053947d365219e82fa7079b9cf.tar.xz
freeipa-f8eda3da3e4cf7053947d365219e82fa7079b9cf.zip
Fix a couple of XML-RPC functions that were missing the opts argument
Include a kerberized XML-RPC client that will list the XML-RPC API
-rw-r--r--ipa-server/xmlrpc-server/ipaxmlrpc.py8
-rw-r--r--ipa-server/xmlrpc-server/test/README6
-rw-r--r--ipa-server/xmlrpc-server/test/test_methods.py57
3 files changed, 67 insertions, 4 deletions
diff --git a/ipa-server/xmlrpc-server/ipaxmlrpc.py b/ipa-server/xmlrpc-server/ipaxmlrpc.py
index aa9044642..9314bd5cf 100644
--- a/ipa-server/xmlrpc-server/ipaxmlrpc.py
+++ b/ipa-server/xmlrpc-server/ipaxmlrpc.py
@@ -227,7 +227,7 @@ class ModXMLRPCRequestHandler(object):
return results
- def list_api(self):
+ def list_api(self,opts):
funcs = []
for name,func in self.funcs.items():
#the keys in self.funcs determine the name of the method as seen over xmlrpc
@@ -249,14 +249,14 @@ class ModXMLRPCRequestHandler(object):
args.append(func.func_code.co_varnames[x])
return args
- def system_listMethods(self):
+ def system_listMethods(self, opts):
return self.funcs.keys()
- def system_methodSignature(self, method):
+ def system_methodSignature(self, method, opts):
#it is not possible to autogenerate this data
return 'signatures not supported'
- def system_methodHelp(self, method):
+ def system_methodHelp(self, method, opts):
func = self.funcs.get(method)
if func is None:
return ""
diff --git a/ipa-server/xmlrpc-server/test/README b/ipa-server/xmlrpc-server/test/README
index c46284d22..544efa526 100644
--- a/ipa-server/xmlrpc-server/test/README
+++ b/ipa-server/xmlrpc-server/test/README
@@ -52,3 +52,9 @@ Sucessfully bound to LDAP using SASL mechanism GSSAPI<br>
It should print all of the environment variables available to mod_python
and do a GSSAPI LDAP connection.
+
+A final test, which lists the capabilities of the XML-RPC server is
+test_methods.py. This is more a sanity check that new functions added
+to the server work as expected.
+
+Note that opts is added by the server itself and is not passed in by the user.
diff --git a/ipa-server/xmlrpc-server/test/test_methods.py b/ipa-server/xmlrpc-server/test/test_methods.py
new file mode 100644
index 000000000..7dad078ca
--- /dev/null
+++ b/ipa-server/xmlrpc-server/test/test_methods.py
@@ -0,0 +1,57 @@
+#!/usr/bin/python
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Simple program to interrogate the XML-RPC server for information on what
+# it can do.
+
+import sys
+import xmlrpclib
+from ipa.krbtransport import KerbTransport
+import ipa
+from ipa import config
+
+ipa.config.init_config()
+
+url = "http://" + config.config.get_server() + "/ipa"
+s = xmlrpclib.Server(url, KerbTransport())
+
+print "A list of all methods available on the server."
+print "system.listMethods: ", s.system.listMethods()
+print ""
+
+print "Signatures are not supported."
+print "system.methodSignature: ", s.system.methodSignature("get_user_by_uid")
+print ""
+
+print "Help on a specific method"
+print "system.methodHelp: ", s.system.methodHelp("get_user_by_uid")
+
+print "The entire API:"
+result = s._listapi()
+for item in result:
+ print item['name'],
+ print "(",
+ i = len(item['args'])
+ p = 0
+ for a in item['args']:
+ if isinstance(a, list):
+ print "%s=%s" % (a[0], a[1]),
+ else:
+ print a,
+ if p < i - 1:
+ print ",",
+ p = p + 1
+ print ")"