Fixing tox and pylint errors

Fixing import errors introduced by commits
icac3475a0454b730d6e5b2093c2e63d395acd387 and
0b7d9c5.

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

Reviewed-By: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Tomas Krizek <tkrizek@redhat.com>
This commit is contained in:
Felipe Barreto 2017-10-20 13:22:33 +02:00 committed by Tomas Krizek
parent b29db07c3b
commit be66eadb62
No known key found for this signature in database
GPG Key ID: 22A2A94B5E49415A
3 changed files with 31 additions and 6 deletions

View File

@ -31,6 +31,7 @@ env:
test_ipapython
test_ipaserver
test_pkcs10
test_integration/test_ipalib_util.py
test_xmlrpc/test_[l-z]*.py"
- TASK_TO_RUN="run-tests"
PYTHON=/usr/bin/python3
@ -46,6 +47,7 @@ env:
test_ipapython
test_ipaserver
test_pkcs10
test_integration/test_ipalib_util.py
test_xmlrpc/test_[l-uw-z]*.py"
# FIXME: add vault tests once PKI finally fixes vault
install:

View File

@ -55,10 +55,6 @@ from ipalib.constants import (
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,9 @@ from ipapython.admintool import ScriptError
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 +1077,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')

View File

@ -0,0 +1,23 @@
#
# Copyright (C) 2017 FreeIPA Contributors see COPYING for license
#
"""
Test the `ipalib.util` module.
This tests is in test_integration beucase we only can import ipaplatform here.
"""
from ipalib import util
from ipaplatform.paths import paths
import pytest
pytestmark = pytest.mark.tier0
def test_hardcoded_paths_are_right():
"""
Test if constants created in ipalib.util are in sync with
paths declared in ipaplatform.paths
"""
assert util._IPA_CLIENT_SYSRESTORE == paths.IPA_CLIENT_SYSRESTORE
assert util._IPA_DEFAULT_CONF == paths.IPA_DEFAULT_CONF