Blob Blame History Raw
From 424b8c73fa0c92ea8befe6e918c0bcaee384ed6b Mon Sep 17 00:00:00 2001
From: Jan Cholasta <jcholast@redhat.com>
Date: Tue, 17 Mar 2015 09:35:49 +0000
Subject: [PATCH] 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>
---
 ipa-client/ipa-install/ipa-client-install | 4 ++--
 ipa-client/ipaclient/ipa_certupdate.py    | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install
index c60124472005670834496569f550f0ffd986aa27..b7b3d05b6b6d1c9635084e0c01aa7443bb559db2 100755
--- a/ipa-client/ipa-install/ipa-client-install
+++ b/ipa-client/ipa-install/ipa-client-install
@@ -2645,10 +2645,10 @@ def install(options, env, fstore, statestore):
     try:
         result = api.Backend.rpcclient.forward(
             'ca_is_enabled',
-            version=u'2.0',
+            version=u'2.107',
         )
         ca_enabled = result['result']
-    except errors.CommandError:
+    except (errors.CommandError, errors.NetworkError):
         result = api.Backend.rpcclient.forward(
             'env',
             server=True,
diff --git a/ipa-client/ipaclient/ipa_certupdate.py b/ipa-client/ipaclient/ipa_certupdate.py
index 031a34c3a54a02d43978eedcb794678a1550702b..5ec5026f5ff7bf93227ce0a551fbf5cf60b9175d 100644
--- a/ipa-client/ipaclient/ipa_certupdate.py
+++ b/ipa-client/ipaclient/ipa_certupdate.py
@@ -63,10 +63,10 @@ class CertUpdate(admintool.AdminTool):
             try:
                 result = api.Backend.rpcclient.forward(
                     'ca_is_enabled',
-                    version=u'2.0',
+                    version=u'2.107',
                 )
                 ca_enabled = result['result']
-            except errors.CommandError:
+            except (errors.CommandError, errors.NetworkError):
                 result = api.Backend.rpcclient.forward(
                     'env',
                     server=True,
-- 
2.1.0