URL: https://github.com/freeipa/freeipa/pull/295
Author: tiran
 Title: #295: Issue6474 fixups
Action: opened

PR body:
"""
Three small fixes that slipped through the review of #271.

* ipatests for ipalib and ipapython no longer depend on ipaplatform
* pylint fix for ipapython.certdb for client-only installations
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/295/head:pr295
git checkout pr295
From 72b813381bafe7ae0479fb6f608936f29486ff49 Mon Sep 17 00:00:00 2001
From: Christian Heimes <chei...@redhat.com>
Date: Thu, 1 Dec 2016 14:49:14 +0100
Subject: [PATCH 1/3] Remove BIN_FALSE and BIN_TRUE

https://fedorahosted.org/freeipa/ticket/6474

Signed-off-by: Christian Heimes <chei...@redhat.com>
---
 ipaplatform/base/paths.py           | 2 --
 ipatests/test_ipalib/test_errors.py | 8 ++++----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/ipaplatform/base/paths.py b/ipaplatform/base/paths.py
index 9942fc1..f85a2aa 100644
--- a/ipaplatform/base/paths.py
+++ b/ipaplatform/base/paths.py
@@ -24,13 +24,11 @@
 
 class BasePathNamespace(object):
     BASH = "/bin/bash"
-    BIN_FALSE = "/bin/false"
     BIN_HOSTNAMECTL = "/bin/hostnamectl"
     LS = "/bin/ls"
     SH = "/bin/sh"
     SYSTEMCTL = "/bin/systemctl"
     TAR = "/bin/tar"
-    BIN_TRUE = "/bin/true"
     AUTOFS_LDAP_AUTH_CONF = "/etc/autofs_ldap_auth.conf"
     ETC_DIRSRV = "/etc/dirsrv"
     DS_KEYTAB = "/etc/dirsrv/ds.keytab"
diff --git a/ipatests/test_ipalib/test_errors.py b/ipatests/test_ipalib/test_errors.py
index 43cd926..893a3e9 100644
--- a/ipatests/test_ipalib/test_errors.py
+++ b/ipatests/test_ipalib/test_errors.py
@@ -32,7 +32,6 @@
 
 from ipatests.util import assert_equal, raises
 from ipalib import errors
-from ipaplatform.paths import paths
 from ipalib.constants import TYPE_ERROR
 
 if six.PY3:
@@ -115,10 +114,11 @@ def test_init(self):
         """
         Test the `ipalib.errors.SubprocessError.__init__` method.
         """
-        inst = self.new(returncode=1, argv=(paths.BIN_FALSE,))
+        bin_false = '/bin/false'
+        inst = self.new(returncode=1, argv=(bin_false,))
         assert inst.returncode == 1
-        assert inst.argv == (paths.BIN_FALSE,)
-        assert str(inst) == "return code 1 from ('/bin/false',)"
+        assert inst.argv == (bin_false,)
+        assert str(inst) == "return code 1 from ('{}',)".format(bin_false)
         assert inst.message == str(inst)
 
 

From ba84fd54727939191794f3744685507636b99657 Mon Sep 17 00:00:00 2001
From: Christian Heimes <chei...@redhat.com>
Date: Thu, 1 Dec 2016 14:52:39 +0100
Subject: [PATCH 2/3] Remove import of ipaplatform.paths from test_ipalib

ipalib's env bootstrapping uses hard-coded defaults, too.

https://fedorahosted.org/freeipa/ticket/6474

Signed-off-by: Christian Heimes <chei...@redhat.com>
---
 ipatests/test_ipalib/test_config.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/ipatests/test_ipalib/test_config.py b/ipatests/test_ipalib/test_config.py
index 22373e1..1df9a39 100644
--- a/ipatests/test_ipalib/test_config.py
+++ b/ipatests/test_ipalib/test_config.py
@@ -30,7 +30,6 @@
 from ipalib.constants import OVERRIDE_ERROR, SET_ERROR, DEL_ERROR
 from ipalib.constants import NAME_REGEX, NAME_ERROR
 from ipalib import config, constants, base
-from ipaplatform.paths import paths
 
 import pytest
 
@@ -450,8 +449,8 @@ def test_bootstrap(self):
         assert o.dot_ipa == home.join('.ipa')
         assert o.in_tree is False
         assert o.context == 'default'
-        assert o.confdir == paths.ETC_IPA
-        assert o.conf == paths.IPA_DEFAULT_CONF
+        assert o.confdir == '/etc/ipa'
+        assert o.conf == '/etc/ipa/default.conf'
         assert o.conf_default == o.conf
 
         # Test overriding values created by _bootstrap()
@@ -463,11 +462,11 @@ def test_bootstrap(self):
         assert o.in_tree is False
         assert o.context == 'default'
         assert o.conf == '/my/wacky/whatever.conf'
-        assert o.conf_default == paths.IPA_DEFAULT_CONF
+        assert o.conf_default == '/etc/ipa/default.conf'
         (o, home) = self.bootstrap(conf_default='/my/wacky/default.conf')
         assert o.in_tree is False
         assert o.context == 'default'
-        assert o.conf == paths.IPA_DEFAULT_CONF
+        assert o.conf == '/etc/ipa/default.conf'
         assert o.conf_default == '/my/wacky/default.conf'
 
         # Test various overrides and types conversion

From d1cc136b12347a4c155eda4242a68f0463f76f04 Mon Sep 17 00:00:00 2001
From: Christian Heimes <chei...@redhat.com>
Date: Thu, 1 Dec 2016 14:56:49 +0100
Subject: [PATCH 3/3] Add pylint guard to import of ipaplatform in
 ipapython.certdb

ipaplatform is not available in PyPI wheel packages. The guard silences
a pylint error in wheel pylint tests.

https://fedorahosted.org/freeipa/ticket/6474

Signed-off-by: Christian Heimes <chei...@redhat.com>
---
 ipapython/certdb.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/ipapython/certdb.py b/ipapython/certdb.py
index 5344e37..af98a77 100644
--- a/ipapython/certdb.py
+++ b/ipapython/certdb.py
@@ -32,14 +32,16 @@
 from ipalib import x509
 
 try:
-    from ipaplatform.paths import paths
-    CERTUTIL = paths.CERTUTIL
-    PK12UTIL = paths.PK12UTIL
-    OPENSSL = paths.OPENSSL
+    from ipaplatform.paths import paths  # pylint: disable=import-error
 except ImportError:
     CERTUTIL = '/usr/bin/certutil'
     PK12UTIL = '/usr/bin/pk12util'
     OPENSSL = '/usr/bin/openssl'
+else:
+    CERTUTIL = paths.CERTUTIL
+    PK12UTIL = paths.PK12UTIL
+    OPENSSL = paths.OPENSSL
+
 
 CA_NICKNAME_FMT = "%s IPA CA"
 
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to