summaryrefslogtreecommitdiffstats
path: root/ipa-client
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2012-12-19 04:25:24 -0500
committerPetr Viktorin <pviktori@redhat.com>2013-11-26 16:59:59 +0100
commit1e836d2d0c8916f5b8a352cc8395048f1147554d (patch)
tree6c13ccd9083803e3945d40516d2add39533a4929 /ipa-client
parenta1165ffbb80446890e3757113c9682c8526ed666 (diff)
downloadfreeipa-1e836d2d0c8916f5b8a352cc8395048f1147554d.tar.gz
freeipa-1e836d2d0c8916f5b8a352cc8395048f1147554d.tar.xz
freeipa-1e836d2d0c8916f5b8a352cc8395048f1147554d.zip
Switch client to JSON-RPC
Modify ipalib.rpc to support JSON-RPC in addition to XML-RPC. This is done by subclassing and extending xmlrpclib, because our existing code relies on xmlrpclib internals. The URI to use is given in the new jsonrpc_uri env variable. When it is not given, it is generated from xmlrpc_uri by replacing /xml with /json. The rpc_json_uri env variable existed before, but was unused, undocumented and not set the install scripts. This patch removes it in favor of jsonrpc_uri (for consistency with xmlrpc_uri). Add the rpc_protocol env variable to control the protocol IPA uses. rpc_protocol defaults to 'jsonrpc', but may be changed to 'xmlrpc'. Make backend.Executioner and tests use the backend specified by rpc_protocol. For compatibility with unwrap_xml, decoding JSON now gives tuples instead of lists. Design: http://freeipa.org/page/V3/JSON-RPC Ticket: https://fedorahosted.org/freeipa/ticket/3299
Diffstat (limited to 'ipa-client')
-rwxr-xr-xipa-client/ipa-install/ipa-client-automount2
-rwxr-xr-xipa-client/ipa-install/ipa-client-install14
-rw-r--r--ipa-client/man/default.conf.58
3 files changed, 15 insertions, 9 deletions
diff --git a/ipa-client/ipa-install/ipa-client-automount b/ipa-client/ipa-install/ipa-client-automount
index 2ce31dcb..076bf081 100755
--- a/ipa-client/ipa-install/ipa-client-automount
+++ b/ipa-client/ipa-install/ipa-client-automount
@@ -436,7 +436,7 @@ def main():
sys.exit("Failed to obtain host TGT.")
# Now we have a TGT, connect to IPA
try:
- api.Backend.xmlclient.connect()
+ api.Backend.rpcclient.connect()
except errors.KerberosError, e:
sys.exit('Cannot connect to the server due to ' + str(e))
try:
diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install
index e79cb48b..c74e6840 100755
--- a/ipa-client/ipa-install/ipa-client-install
+++ b/ipa-client/ipa-install/ipa-client-install
@@ -1492,7 +1492,7 @@ def update_ssh_keys(server, hostname, ssh_dir, create_sshfp):
try:
# Use the RPC directly so older servers are supported
- api.Backend.xmlclient.forward(
+ api.Backend.rpcclient.forward(
'host_mod',
unicode(hostname),
ipasshpubkey=[pk.openssh() for pk in pubkeys],
@@ -2458,19 +2458,19 @@ def install(options, env, fstore, statestore):
# Now, let's try to connect to the server's XML-RPC interface
connected = False
try:
- api.Backend.xmlclient.connect()
+ api.Backend.rpcclient.connect()
connected = True
root_logger.debug('Try RPC connection')
- api.Backend.xmlclient.forward('ping')
+ api.Backend.rpcclient.forward('ping')
except errors.KerberosError, e:
if connected:
- api.Backend.xmlclient.disconnect()
+ api.Backend.rpcclient.disconnect()
root_logger.info('Cannot connect to the server due to ' +
'Kerberos error: %s. Trying with delegate=True', str(e))
try:
- api.Backend.xmlclient.connect(delegate=True)
+ api.Backend.rpcclient.connect(delegate=True)
root_logger.debug('Try RPC connection')
- api.Backend.xmlclient.forward('ping')
+ api.Backend.rpcclient.forward('ping')
root_logger.info('Connection with delegate=True successful')
@@ -2493,7 +2493,7 @@ def install(options, env, fstore, statestore):
return CLIENT_INSTALL_ERROR
# Use the RPC directly so older servers are supported
- result = api.Backend.xmlclient.forward(
+ result = api.Backend.rpcclient.forward(
'env',
server=True,
version=u'2.0',
diff --git a/ipa-client/man/default.conf.5 b/ipa-client/man/default.conf.5
index 9e87bb7c..5d5a48db 100644
--- a/ipa-client/man/default.conf.5
+++ b/ipa-client/man/default.conf.5
@@ -179,7 +179,13 @@ Used internally in the IPA source package to verify that the API has not changed
When True provides more information. Specifically this sets the global log level to "info".
.TP
.B xmlrpc_uri <URI>
-Specifies the URI of the XML\-RPC server for a client. This is used by IPA and some external tools as well, such as ipa\-getcert. e.g. https://ipa.example.com/ipa/xml
+Specifies the URI of the XML\-RPC server for a client. This may be used by IPA, and is used by some external tools, such as ipa\-getcert. Example: https://ipa.example.com/ipa/xml
+.TP
+.B jsonrpc_uri <URI>
+Specifies the URI of the JSON server for a client. This is used by IPA. If not given, it is derived from xmlrpc_uri. Example: https://ipa.example.com/ipa/json
+.TP
+.B rpc_protocol <URI>
+Specifies the type of RPC calls IPA makes: 'jsonrpc' or 'xmlrpc'. Defaults to 'jsonrpc'.
.TP
The following define the containers for the IPA server. Containers define where in the DIT that objects can be found. The full location is the value of container + basedn.
container_accounts: cn=accounts