URL: https://github.com/freeipa/freeipa/pull/1184
Author: tiran
 Title: #1184: Drop import of ipaplatform to fix PyPI packages
Action: opened

PR body:
"""
ipalib.util imports ipaplatform but ipaplatform package is not available
as wheel package on PyPI. Fixes import errors introduced by commits
cac3475a and 0b7d9c5.

https://pagure.io/freeipa/issue/7132

Original patch by Felipe Barreto Volpone <fbarr...@redhat.com>
Signed-off-by: Christian Heimes <chei...@redhat.com>
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1184/head:pr1184
git checkout pr1184
From 37c49ff8b50e5a5345fe7381451e8f74b3c9fd04 Mon Sep 17 00:00:00 2001
From: Christian Heimes <chei...@redhat.com>
Date: Wed, 18 Oct 2017 10:56:34 +0200
Subject: [PATCH] Drop import of ipaplatform to fix PyPI packages

ipalib.util imports ipaplatform but ipaplatform package is not available
as wheel package on PyPI. Fixes import errors introduced by commits
cac3475a and 0b7d9c5.

https://pagure.io/freeipa/issue/7132

Original patch by Felipe Barreto Volpone <fbarr...@redhat.com>
Signed-off-by: Christian Heimes <chei...@redhat.com>
---
 ipalib/util.py | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/ipalib/util.py b/ipalib/util.py
index 91d6e469a5..d6cb264a07 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,11 @@
 if six.PY3:
     unicode = str
 
+
+_IPA_CLIENT_SYSRESTORE = "/var/lib/ipa-client/sysrestore"
+_IPA_DEFAULT_CONF = "/etc/ipa/default.conf"
+
+
 logger = logging.getLogger(__name__)
 
 
@@ -1078,8 +1079,9 @@ 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 os.path.isfile(_IPA_DEFAULT_CONF) or
+            not os.path.isdir(_IPA_CLIENT_SYSRESTORE) or
+            not os.listdir(_IPA_CLIENT_SYSRESTORE)):
         raise ScriptError('IPA client is not configured on this system')
 
 
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to