From bef118025e2212b00c0cb742af5c215f74c2a3a1 Mon Sep 17 00:00:00 2001
From: Felipe Volpone <fbarreto@redhat.com>
Date: Mon, 4 Sep 2017 17:11:24 -0300
Subject: [PATCH] Fixing tox and pylint errors

Fixing import errors introduced by commits
cac3475a0454b730d6e5b2093c2e63d395acd387 and
0b7d9c5a7b271f0e8b296dac86525b9ce948084a.

https://pagure.io/freeipa/issue/7132
---
 ipalib/util.py | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/ipalib/util.py b/ipalib/util.py
index 91d6e469a5..9f172490f4 100644
--- a/ipalib/util.py
+++ b/ipalib/util.py
@@ -55,10 +55,6 @@
     TLS_VERSIONS, TLS_VERSION_MINIMAL, TLS_HIGH_CIPHERS
 )
 from ipalib.text import _
-# pylint: disable=ipa-forbidden-import
-from ipalib.install import sysrestore
-from ipaplatform.paths import paths
-# pylint: enable=ipa-forbidden-import
 from ipapython.ssh import SSHPublicKey
 from ipapython.dn import DN, RDN
 from ipapython.dnsutil import DNSName
@@ -68,6 +64,19 @@
 if six.PY3:
     unicode = str
 
+
+try:
+    # pylint: disable=import-error,ipa-forbidden-import
+    from ipaplatform.paths import paths
+    # pylint: enable=import-error,ipa-forbidden-import
+except ImportError:
+    IPA_CLIENT_SYSRESTORE = "/var/lib/ipa-client/sysrestore"
+    IPA_DEFAULT_CONF = "/etc/ipa/default.conf"
+else:
+    IPA_CLIENT_SYSRESTORE = paths.IPA_CLIENT_SYSRESTORE
+    IPA_DEFAULT_CONF = paths.IPA_DEFAULT_CONF
+
+
 logger = logging.getLogger(__name__)
 
 
@@ -1078,8 +1087,8 @@ def check_client_configuration():
     """
     Check if IPA client is configured on the system.
     """
-    fstore = sysrestore.FileStore(paths.IPA_CLIENT_SYSRESTORE)
-    if not fstore.has_files() and not os.path.exists(paths.IPA_DEFAULT_CONF):
+    if (not any(os.listdir(IPA_CLIENT_SYSRESTORE)) and not
+       os.path.exists(IPA_DEFAULT_CONF)):
         raise ScriptError('IPA client is not configured on this system')
 
 
