Drop an explicit requirement of oslo.log

This library is designed for leaf applications (services, CLI). For
libraries it's enough to use the generic logging.

Unit tests needed adjustment since LOG.exception is implemented via
LOG.error internally.

Change-Id: I943e1f07a23e76354966acae5e4594e41dd4822b
This commit is contained in:
Dmitry Tantsur 2021-08-20 16:56:35 +02:00
parent 44131be92a
commit ac95888059
10 changed files with 18 additions and 15 deletions

View File

@ -15,15 +15,15 @@
import base64
import binascii
import logging
import bcrypt
from oslo_log import log
import webob
from ironic_lib.common.i18n import _
from ironic_lib import exception
LOG = log.getLogger(__name__)
LOG = logging.getLogger(__name__)
class BasicAuthMiddleware(object):

View File

@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
from oslo_config import cfg
from oslo_log import log as logging
from ironic_lib.common.i18n import _
from ironic_lib import exception

View File

@ -25,9 +25,9 @@ SHOULD include dedicated exception logging.
import collections
from http import client as http_client
import json
import logging
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
from ironic_lib.common.i18n import _

View File

@ -15,8 +15,9 @@
This client is compatible with any JSON RPC 2.0 implementation, including ours.
"""
import logging
from oslo_config import cfg
from oslo_log import log
from oslo_utils import importutils
from oslo_utils import netutils
from oslo_utils import strutils
@ -29,7 +30,7 @@ from ironic_lib import keystone
CONF = cfg.CONF
LOG = log.getLogger(__name__)
LOG = logging.getLogger(__name__)
_SESSION = None

View File

@ -20,13 +20,13 @@ https://www.jsonrpc.org/specification. Main differences:
"""
import json
import logging
try:
from keystonemiddleware import auth_token
except ImportError:
auth_token = None
from oslo_config import cfg
from oslo_log import log
try:
import oslo_messaging
except ImportError:
@ -43,7 +43,7 @@ from ironic_lib import json_rpc
CONF = cfg.CONF
LOG = log.getLogger(__name__)
LOG = logging.getLogger(__name__)
_DENY_LIST = {'init_host', 'del_host', 'target', 'iter_nodes'}

View File

@ -14,6 +14,7 @@
import copy
import functools
import logging
from keystoneauth1 import exceptions as ks_exception
from keystoneauth1 import loading as ks_loading
@ -21,7 +22,6 @@ from keystoneauth1 import service_token
from keystoneauth1 import token_endpoint
import os_service_types
from oslo_config import cfg
from oslo_log import log as logging
from ironic_lib import exception

View File

@ -18,13 +18,13 @@ https://review.opendev.org/651222.
import collections
import ipaddress
import logging
import socket
import time
from urllib import parse as urlparse
from oslo_config import cfg
from oslo_config import types as cfg_types
from oslo_log import log as logging
import zeroconf
from ironic_lib.common.i18n import _

View File

@ -14,10 +14,10 @@
# under the License.
import contextlib
import logging
import socket
from oslo_config import cfg
from oslo_log import log
from ironic_lib import metrics
@ -33,7 +33,7 @@ statsd_opts = [
CONF = cfg.CONF
CONF.register_opts(statsd_opts, group='metrics_statsd')
LOG = log.getLogger(__name__)
LOG = logging.getLogger(__name__)
class StatsdMetricLogger(metrics.MetricLogger):

View File

@ -51,7 +51,8 @@ class TestIronicException(base.IronicLibTestCase):
CONF.set_override('fatal_exception_format_errors', False,
group='ironic_lib')
e = TestException(spam=Unserializable(), ham='eggs')
message = log_mock.call_args[0][0] % log_mock.call_args[0][1]
message = \
log_mock.call_args_list[0][0][0] % log_mock.call_args_list[0][0][1]
self.assertIsNotNone(
re.search('spam: .*JSON.* NotImplementedError: nostr', message),
message
@ -64,7 +65,8 @@ class TestIronicException(base.IronicLibTestCase):
group='ironic_lib')
self.assertRaises(KeyError, TestException, spam=Unserializable(),
ham='eggs')
message = log_mock.call_args[0][0] % log_mock.call_args[0][1]
message = \
log_mock.call_args_list[0][0][0] % log_mock.call_args_list[0][0][1]
self.assertIsNotNone(
re.search('spam: .*JSON.* NotImplementedError: nostr', message),
message

View File

@ -7,7 +7,6 @@ oslo.concurrency>=3.26.0 # Apache-2.0
oslo.config>=5.2.0 # Apache-2.0
oslo.i18n>=3.15.3 # Apache-2.0
oslo.utils>=3.34.0 # Apache-2.0
oslo.log>=3.36.0 # Apache-2.0
zeroconf>=0.24.0 # LGPL
bcrypt>=3.1.3 # Apache-2.0
WebOb>=1.7.1 # MIT