Merge "Fix novajoin-ipa-setup to set logging correctly"
This commit is contained in:
commit
73a47b6652
|
@ -155,8 +155,11 @@ class NovajoinRole(object):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise ConfigurationError("get_ca_certs() error: %s" % e)
|
raise ConfigurationError("get_ca_certs() error: %s" % e)
|
||||||
|
|
||||||
certs = [x509.load_certificate(c[0], x509.DER) for c in certs
|
if version.NUM_VERSION < 40600:
|
||||||
if c[2] is not False]
|
certs = [x509.load_certificate(c[0], x509.DER) for c in certs
|
||||||
|
if c[2] is not False]
|
||||||
|
else:
|
||||||
|
certs = [c[0] for c in certs if c[2] is not False]
|
||||||
|
|
||||||
return certs
|
return certs
|
||||||
|
|
||||||
|
@ -200,8 +203,9 @@ class NovajoinRole(object):
|
||||||
os.close(cafile_fd)
|
os.close(cafile_fd)
|
||||||
|
|
||||||
ca_certs = self._get_ca_certs(server, realm)
|
ca_certs = self._get_ca_certs(server, realm)
|
||||||
ca_certs = [cert.public_bytes(serialization.Encoding.PEM)
|
if version.NUM_VERSION < 40600:
|
||||||
for cert in ca_certs]
|
ca_certs = [cert.public_bytes(serialization.Encoding.PEM)
|
||||||
|
for cert in ca_certs]
|
||||||
x509.write_certificate_list(ca_certs, cafile_name)
|
x509.write_certificate_list(ca_certs, cafile_name)
|
||||||
|
|
||||||
return cafile_name
|
return cafile_name
|
||||||
|
|
|
@ -28,10 +28,8 @@ import testtools
|
||||||
import time
|
import time
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
|
|
||||||
from ipapython.ipa_log_manager import log_mgr
|
|
||||||
|
|
||||||
from ipalib import api
|
from ipalib import api
|
||||||
|
from ipapython import version
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from novajoin import config
|
from novajoin import config
|
||||||
|
@ -58,9 +56,14 @@ class TestIPAService(testtools.TestCase):
|
||||||
CONF.keytab = '/tmp/test.keytab'
|
CONF.keytab = '/tmp/test.keytab'
|
||||||
super(TestIPAService, self).setUp()
|
super(TestIPAService, self).setUp()
|
||||||
self.ipaclient = IPAClient()
|
self.ipaclient = IPAClient()
|
||||||
|
|
||||||
# suppress the Forwarding messages from ipa
|
# suppress the Forwarding messages from ipa
|
||||||
console = log_mgr.get_handler('console')
|
# This is not needed in versions newer than 4.7
|
||||||
console.setLevel(logging.WARN)
|
if version.NUM_VERSION < 40600:
|
||||||
|
from ipapython.ipa_log_manager import log_mgr
|
||||||
|
console = log_mgr.get_handler('console')
|
||||||
|
console.setLevel(logging.WARN)
|
||||||
|
|
||||||
if hostname is None:
|
if hostname is None:
|
||||||
hostname = six.text_type(str(uuid.uuid4()) + '.' + api.env.domain)
|
hostname = six.text_type(str(uuid.uuid4()) + '.' + api.env.domain)
|
||||||
os.environ['KRB5_CONFIG'] = 'krb5.conf'
|
os.environ['KRB5_CONFIG'] = 'krb5.conf'
|
||||||
|
|
|
@ -20,7 +20,6 @@ import shutil
|
||||||
import sys
|
import sys
|
||||||
from ipalib import api, errors
|
from ipalib import api, errors
|
||||||
from ipapython import version
|
from ipapython import version
|
||||||
from ipapython.ipa_log_manager import log_mgr
|
|
||||||
from novajoin import configure_ipa
|
from novajoin import configure_ipa
|
||||||
from novajoin.errors import ConfigurationError
|
from novajoin.errors import ConfigurationError
|
||||||
|
|
||||||
|
@ -67,8 +66,11 @@ if __name__ == '__main__':
|
||||||
and opts.realm and opts.server)
|
and opts.realm and opts.server)
|
||||||
|
|
||||||
# suppress the Forwarding messages from ipa
|
# suppress the Forwarding messages from ipa
|
||||||
console = log_mgr.get_handler('console')
|
# This is not needed in versions newer than 4.7
|
||||||
console.setLevel(logging.WARN)
|
if version.NUM_VERSION < 40600:
|
||||||
|
from ipapython.ipa_log_manager import log_mgr
|
||||||
|
console = log_mgr.get_handler('console')
|
||||||
|
console.setLevel(logging.WARN)
|
||||||
|
|
||||||
novajoin = configure_ipa.NovajoinRole(user=opts.user,
|
novajoin = configure_ipa.NovajoinRole(user=opts.user,
|
||||||
hostname=opts.hostname)
|
hostname=opts.hostname)
|
||||||
|
|
Loading…
Reference in New Issue