0201d8
From 424b8c73fa0c92ea8befe6e918c0bcaee384ed6b Mon Sep 17 00:00:00 2001
0201d8
From: Jan Cholasta <jcholast@redhat.com>
0201d8
Date: Tue, 17 Mar 2015 09:35:49 +0000
0201d8
Subject: [PATCH] client: Fix ca_is_enabled calls
0201d8
0201d8
The command was added in API version 2.107. Old IPA servers may crash with
0201d8
NetworkError on ca_is_enabled, handle this case gracefully.
0201d8
0201d8
https://fedorahosted.org/freeipa/ticket/4565
0201d8
0201d8
Reviewed-By: David Kupka <dkupka@redhat.com>
0201d8
---
0201d8
 ipa-client/ipa-install/ipa-client-install | 4 ++--
0201d8
 ipa-client/ipaclient/ipa_certupdate.py    | 4 ++--
0201d8
 2 files changed, 4 insertions(+), 4 deletions(-)
0201d8
0201d8
diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install
0201d8
index c60124472005670834496569f550f0ffd986aa27..b7b3d05b6b6d1c9635084e0c01aa7443bb559db2 100755
0201d8
--- a/ipa-client/ipa-install/ipa-client-install
0201d8
+++ b/ipa-client/ipa-install/ipa-client-install
0201d8
@@ -2645,10 +2645,10 @@ def install(options, env, fstore, statestore):
0201d8
     try:
0201d8
         result = api.Backend.rpcclient.forward(
0201d8
             'ca_is_enabled',
0201d8
-            version=u'2.0',
0201d8
+            version=u'2.107',
0201d8
         )
0201d8
         ca_enabled = result['result']
0201d8
-    except errors.CommandError:
0201d8
+    except (errors.CommandError, errors.NetworkError):
0201d8
         result = api.Backend.rpcclient.forward(
0201d8
             'env',
0201d8
             server=True,
0201d8
diff --git a/ipa-client/ipaclient/ipa_certupdate.py b/ipa-client/ipaclient/ipa_certupdate.py
0201d8
index 031a34c3a54a02d43978eedcb794678a1550702b..5ec5026f5ff7bf93227ce0a551fbf5cf60b9175d 100644
0201d8
--- a/ipa-client/ipaclient/ipa_certupdate.py
0201d8
+++ b/ipa-client/ipaclient/ipa_certupdate.py
0201d8
@@ -63,10 +63,10 @@ class CertUpdate(admintool.AdminTool):
0201d8
             try:
0201d8
                 result = api.Backend.rpcclient.forward(
0201d8
                     'ca_is_enabled',
0201d8
-                    version=u'2.0',
0201d8
+                    version=u'2.107',
0201d8
                 )
0201d8
                 ca_enabled = result['result']
0201d8
-            except errors.CommandError:
0201d8
+            except (errors.CommandError, errors.NetworkError):
0201d8
                 result = api.Backend.rpcclient.forward(
0201d8
                     'env',
0201d8
                     server=True,
0201d8
-- 
0201d8
2.1.0
0201d8