client: Fix ca_is_enabled calls

The command was added in API version 2.107. Old IPA servers may crash with
NetworkError on ca_is_enabled, handle this case gracefully.

https://fedorahosted.org/freeipa/ticket/4565

Reviewed-By: David Kupka <dkupka@redhat.com>
This commit is contained in:
Jan Cholasta 2015-03-17 09:35:49 +00:00
parent ad77613be6
commit 6e672109ea
2 changed files with 4 additions and 4 deletions

View File

@ -2641,10 +2641,10 @@ def install(options, env, fstore, statestore):
try: try:
result = api.Backend.rpcclient.forward( result = api.Backend.rpcclient.forward(
'ca_is_enabled', 'ca_is_enabled',
version=u'2.0', version=u'2.107',
) )
ca_enabled = result['result'] ca_enabled = result['result']
except errors.CommandError: except (errors.CommandError, errors.NetworkError):
result = api.Backend.rpcclient.forward( result = api.Backend.rpcclient.forward(
'env', 'env',
server=True, server=True,

View File

@ -63,10 +63,10 @@ class CertUpdate(admintool.AdminTool):
try: try:
result = api.Backend.rpcclient.forward( result = api.Backend.rpcclient.forward(
'ca_is_enabled', 'ca_is_enabled',
version=u'2.0', version=u'2.107',
) )
ca_enabled = result['result'] ca_enabled = result['result']
except errors.CommandError: except (errors.CommandError, errors.NetworkError):
result = api.Backend.rpcclient.forward( result = api.Backend.rpcclient.forward(
'env', 'env',
server=True, server=True,