From 279d07eebba14f819d2e950069284d8e18fc04f6 Mon Sep 17 00:00:00 2001 From: Brian Waldon Date: Tue, 10 Jul 2012 21:39:06 -0700 Subject: [PATCH] Update 'logging' imports to openstack-common Change-Id: Ia1a7b5062e7f882971f2061274f6a4a44cfc8ced --- glance/api/middleware/cache.py | 2 +- glance/api/middleware/cache_manage.py | 3 +-- glance/api/middleware/context.py | 3 ++- glance/api/middleware/version_negotiation.py | 3 +-- glance/api/policy.py | 2 +- glance/api/v1/controller.py | 3 +-- glance/api/v1/images.py | 2 +- glance/api/v1/members.py | 3 +-- glance/api/v2/images.py | 2 +- glance/common/auth.py | 2 +- glance/common/client.py | 2 +- glance/common/utils.py | 2 +- glance/common/wsgi.py | 3 ++- glance/db/simple/api.py | 2 +- glance/db/sqlalchemy/api.py | 3 ++- glance/db/sqlalchemy/migrate_repo/schema.py | 4 ++-- .../migrate_repo/versions/015_quote_swift_credentials.py | 2 +- glance/db/sqlalchemy/migration.py | 2 +- glance/image_cache/__init__.py | 3 +-- glance/image_cache/drivers/base.py | 2 +- glance/image_cache/drivers/sqlite.py | 2 +- glance/image_cache/drivers/xattr.py | 2 +- glance/image_cache/prefetcher.py | 3 +-- glance/notifier/__init__.py | 2 +- glance/notifier/notify_kombu.py | 2 +- glance/notifier/notify_log.py | 4 +--- glance/notifier/notify_qpid.py | 2 +- glance/registry/__init__.py | 2 +- glance/registry/api/v1/images.py | 3 +-- glance/registry/api/v1/members.py | 3 +-- glance/store/__init__.py | 2 +- glance/store/base.py | 3 +-- glance/store/filesystem.py | 2 +- glance/store/http.py | 2 +- glance/store/location.py | 2 +- glance/store/rbd.py | 2 +- glance/store/s3.py | 2 +- glance/store/scrubber.py | 2 +- glance/store/swift.py | 2 +- glance/tests/unit/test_notifier.py | 3 +-- glance/tests/unit/utils.py | 3 +-- tools/migrate_image_owners.py | 2 +- 42 files changed, 46 insertions(+), 56 deletions(-) diff --git a/glance/api/middleware/cache.py b/glance/api/middleware/cache.py index 1c0a4839d2..2a2c018502 100644 --- a/glance/api/middleware/cache.py +++ b/glance/api/middleware/cache.py @@ -25,7 +25,6 @@ the local cached copy of the image file is returned. """ import httplib -import logging import re import webob @@ -35,6 +34,7 @@ from glance.common import exception from glance.common import utils from glance.common import wsgi from glance import image_cache +import glance.openstack.common.log as logging from glance import registry LOG = logging.getLogger(__name__) diff --git a/glance/api/middleware/cache_manage.py b/glance/api/middleware/cache_manage.py index f8410a1385..bc827831cd 100644 --- a/glance/api/middleware/cache_manage.py +++ b/glance/api/middleware/cache_manage.py @@ -19,12 +19,11 @@ Image Cache Management API """ -import logging - import routes from glance.api import cached_images from glance.common import wsgi +import glance.openstack.common.log as logging LOG = logging.getLogger(__name__) diff --git a/glance/api/middleware/context.py b/glance/api/middleware/context.py index f90dac84f7..8c870d3bcd 100644 --- a/glance/api/middleware/context.py +++ b/glance/api/middleware/context.py @@ -15,13 +15,14 @@ # License for the specific language governing permissions and limitations # under the License. -import logging import json + import webob.exc from glance.common import wsgi import glance.context from glance.openstack.common import cfg +import glance.openstack.common.log as logging context_opts = [ diff --git a/glance/api/middleware/version_negotiation.py b/glance/api/middleware/version_negotiation.py index 150f890b22..026fb46017 100644 --- a/glance/api/middleware/version_negotiation.py +++ b/glance/api/middleware/version_negotiation.py @@ -21,10 +21,9 @@ and/or Accept headers and attempts to negotiate an API controller to return """ -import logging - from glance.api import versions from glance.common import wsgi +import glance.openstack.common.log as logging LOG = logging.getLogger(__name__) diff --git a/glance/api/policy.py b/glance/api/policy.py index facd228e23..3f1fc8e1b5 100644 --- a/glance/api/policy.py +++ b/glance/api/policy.py @@ -18,11 +18,11 @@ """Policy Engine For Glance""" import json -import logging import os.path from glance.common import exception from glance.openstack.common import cfg +import glance.openstack.common.log as logging from glance.openstack.common import policy LOG = logging.getLogger(__name__) diff --git a/glance/api/v1/controller.py b/glance/api/v1/controller.py index ddb8b9b1ed..25000158a2 100644 --- a/glance/api/v1/controller.py +++ b/glance/api/v1/controller.py @@ -15,11 +15,10 @@ # License for the specific language governing permissions and limitations # under the License. -import logging - import webob.exc from glance.common import exception +import glance.openstack.common.log as logging from glance import registry LOG = logging.getLogger(__name__) diff --git a/glance/api/v1/images.py b/glance/api/v1/images.py index 9a18725964..c7dbd46ea9 100644 --- a/glance/api/v1/images.py +++ b/glance/api/v1/images.py @@ -20,7 +20,6 @@ """ import errno -import logging import sys import traceback @@ -42,6 +41,7 @@ from glance.common import utils from glance.common import wsgi from glance import notifier from glance.openstack.common import cfg +import glance.openstack.common.log as logging from glance import registry from glance.store import (create_stores, get_from_backend, diff --git a/glance/api/v1/members.py b/glance/api/v1/members.py index c98f24759e..943871465d 100644 --- a/glance/api/v1/members.py +++ b/glance/api/v1/members.py @@ -15,13 +15,12 @@ # License for the specific language governing permissions and limitations # under the License. -import logging - import webob.exc from glance.common import exception from glance.common import utils from glance.common import wsgi +import glance.openstack.common.log as logging from glance import registry diff --git a/glance/api/v2/images.py b/glance/api/v2/images.py index cb1476c0b7..b1af907ce4 100644 --- a/glance/api/v2/images.py +++ b/glance/api/v2/images.py @@ -16,7 +16,6 @@ import copy import datetime import json -import logging import urllib import webob.exc @@ -26,6 +25,7 @@ from glance.common import utils from glance.common import wsgi import glance.db from glance.openstack.common import cfg +import glance.openstack.common.log as logging from glance.openstack.common import timeutils import glance.schema diff --git a/glance/common/auth.py b/glance/common/auth.py index 21d3bdd857..82bd184a34 100644 --- a/glance/common/auth.py +++ b/glance/common/auth.py @@ -31,12 +31,12 @@ Keystone (an identity management system). http://service_endpoint/ """ import json -import logging import urlparse import httplib2 from glance.common import exception +import glance.openstack.common.log as logging LOG = logging.getLogger(__name__) diff --git a/glance/common/client.py b/glance/common/client.py index 8caa2a5cfc..0dfff1d58f 100644 --- a/glance/common/client.py +++ b/glance/common/client.py @@ -23,7 +23,6 @@ import collections import errno import functools import httplib -import logging import os import re import select @@ -44,6 +43,7 @@ except ImportError: from glance.common import auth from glance.common import exception, utils +import glance.openstack.common.log as logging LOG = logging.getLogger(__name__) diff --git a/glance/common/utils.py b/glance/common/utils.py index 50b118115e..c24d5124be 100644 --- a/glance/common/utils.py +++ b/glance/common/utils.py @@ -28,7 +28,6 @@ except ImportError: from time import sleep import functools -import logging import os import platform import subprocess @@ -39,6 +38,7 @@ import iso8601 from webob import exc from glance.common import exception +import glance.openstack.common.log as logging LOG = logging.getLogger(__name__) diff --git a/glance/common/wsgi.py b/glance/common/wsgi.py index 25f86aaf9c..07d75980fa 100644 --- a/glance/common/wsgi.py +++ b/glance/common/wsgi.py @@ -42,6 +42,7 @@ import webob.exc from glance.common import exception from glance.common import utils from glance.openstack.common import cfg +import glance.openstack.common.log as os_logging bind_opts = [ @@ -168,7 +169,7 @@ class Server(object): self.application = application self.sock = get_socket(default_port) - self.logger = logging.getLogger('eventlet.wsgi.server') + self.logger = os_logging.getLogger('eventlet.wsgi.server') if CONF.workers == 0: # Useful for profiling, test, debug etc. diff --git a/glance/db/simple/api.py b/glance/db/simple/api.py index 6887181faf..0b13497f59 100644 --- a/glance/db/simple/api.py +++ b/glance/db/simple/api.py @@ -15,10 +15,10 @@ import datetime import functools -import logging import uuid from glance.common import exception +import glance.openstack.common.log as logging LOG = logging.getLogger(__name__) diff --git a/glance/db/sqlalchemy/api.py b/glance/db/sqlalchemy/api.py index 5e8ae8de7a..73744d90c3 100644 --- a/glance/db/sqlalchemy/api.py +++ b/glance/db/sqlalchemy/api.py @@ -33,6 +33,7 @@ from glance.common import exception from glance.db.sqlalchemy import migration from glance.db.sqlalchemy import models from glance.openstack.common import cfg +import glance.openstack.common.log as os_logging from glance.openstack.common import timeutils @@ -42,7 +43,7 @@ _MAX_RETRIES = None _RETRY_INTERVAL = None BASE = models.BASE sa_logger = None -LOG = logging.getLogger(__name__) +LOG = os_logging.getLogger(__name__) CONTAINER_FORMATS = ['ami', 'ari', 'aki', 'bare', 'ovf'] diff --git a/glance/db/sqlalchemy/migrate_repo/schema.py b/glance/db/sqlalchemy/migrate_repo/schema.py index 87e452875a..1fcf845935 100644 --- a/glance/db/sqlalchemy/migrate_repo/schema.py +++ b/glance/db/sqlalchemy/migrate_repo/schema.py @@ -19,10 +19,10 @@ Various conveniences used for migration scripts """ -import logging - import sqlalchemy.types +import glance.openstack.common.log as logging + LOG = logging.getLogger(__name__) diff --git a/glance/db/sqlalchemy/migrate_repo/versions/015_quote_swift_credentials.py b/glance/db/sqlalchemy/migrate_repo/versions/015_quote_swift_credentials.py index c352460590..676fabe4c9 100644 --- a/glance/db/sqlalchemy/migrate_repo/versions/015_quote_swift_credentials.py +++ b/glance/db/sqlalchemy/migrate_repo/versions/015_quote_swift_credentials.py @@ -15,13 +15,13 @@ # License for the specific language governing permissions and limitations # under the License. -import logging import types import urlparse import sqlalchemy from glance.common import exception +import glance.openstack.common.log as logging import glance.store.swift LOG = logging.getLogger(__name__) diff --git a/glance/db/sqlalchemy/migration.py b/glance/db/sqlalchemy/migration.py index ce4c33f191..d76a68d435 100644 --- a/glance/db/sqlalchemy/migration.py +++ b/glance/db/sqlalchemy/migration.py @@ -15,7 +15,6 @@ # License for the specific language governing permissions and limitations # under the License. -import logging import os from migrate.versioning import api as versioning_api @@ -29,6 +28,7 @@ from migrate.versioning import repository as versioning_repository from glance.common import exception from glance.openstack.common import cfg +import glance.openstack.common.log as logging LOG = logging.getLogger(__name__) diff --git a/glance/image_cache/__init__.py b/glance/image_cache/__init__.py index 6449fa4f67..d45e520e0d 100644 --- a/glance/image_cache/__init__.py +++ b/glance/image_cache/__init__.py @@ -19,11 +19,10 @@ LRU Cache for Image Data """ -import logging - from glance.common import exception from glance.common import utils from glance.openstack.common import cfg +import glance.openstack.common.log as logging from glance.openstack.common import importutils LOG = logging.getLogger(__name__) diff --git a/glance/image_cache/drivers/base.py b/glance/image_cache/drivers/base.py index e760d5b722..cb63868726 100644 --- a/glance/image_cache/drivers/base.py +++ b/glance/image_cache/drivers/base.py @@ -19,12 +19,12 @@ Base attribute driver class """ -import logging import os.path from glance.common import exception from glance.common import utils from glance.openstack.common import cfg +import glance.openstack.common.log as logging LOG = logging.getLogger(__name__) diff --git a/glance/image_cache/drivers/sqlite.py b/glance/image_cache/drivers/sqlite.py index e437fc283f..a98c5cfa17 100644 --- a/glance/image_cache/drivers/sqlite.py +++ b/glance/image_cache/drivers/sqlite.py @@ -21,7 +21,6 @@ Cache driver that uses SQLite to store information about cached images from __future__ import absolute_import from contextlib import contextmanager -import logging import os import stat import time @@ -32,6 +31,7 @@ import sqlite3 from glance.common import exception from glance.image_cache.drivers import base from glance.openstack.common import cfg +import glance.openstack.common.log as logging LOG = logging.getLogger(__name__) diff --git a/glance/image_cache/drivers/xattr.py b/glance/image_cache/drivers/xattr.py index 293f8efe20..58e5ef7a6a 100644 --- a/glance/image_cache/drivers/xattr.py +++ b/glance/image_cache/drivers/xattr.py @@ -57,7 +57,6 @@ from __future__ import absolute_import from contextlib import contextmanager import datetime import errno -import logging import os import stat import time @@ -67,6 +66,7 @@ import xattr from glance.common import exception from glance.image_cache.drivers import base from glance.openstack.common import cfg +import glance.openstack.common.log as logging LOG = logging.getLogger(__name__) diff --git a/glance/image_cache/prefetcher.py b/glance/image_cache/prefetcher.py index a14c134644..7f15781eb3 100644 --- a/glance/image_cache/prefetcher.py +++ b/glance/image_cache/prefetcher.py @@ -19,13 +19,12 @@ Prefetches images into the Image Cache """ -import logging - import eventlet from glance.common import exception from glance import context from glance.image_cache import base +import glance.openstack.common.log as logging from glance import registry import glance.store import glance.store.filesystem diff --git a/glance/notifier/__init__.py b/glance/notifier/__init__.py index 88581ea4a5..cfe1642c2e 100644 --- a/glance/notifier/__init__.py +++ b/glance/notifier/__init__.py @@ -16,13 +16,13 @@ # under the License. -import logging import socket import uuid from glance.common import exception from glance.openstack.common import cfg from glance.openstack.common import importutils +import glance.openstack.common.log as logging from glance.openstack.common import timeutils notifier_opts = [ diff --git a/glance/notifier/notify_kombu.py b/glance/notifier/notify_kombu.py index 7f8decad17..e199b94e8b 100644 --- a/glance/notifier/notify_kombu.py +++ b/glance/notifier/notify_kombu.py @@ -15,7 +15,6 @@ import json -import logging import time import kombu.connection @@ -23,6 +22,7 @@ import kombu.entity from glance.notifier import strategy from glance.openstack.common import cfg +import glance.openstack.common.log as logging LOG = logging.getLogger(__name__) diff --git a/glance/notifier/notify_log.py b/glance/notifier/notify_log.py index 46e76ba4ec..4e52c6b17e 100644 --- a/glance/notifier/notify_log.py +++ b/glance/notifier/notify_log.py @@ -14,10 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. - -import logging - from glance.notifier import strategy +import glance.openstack.common.log as logging class LoggingStrategy(strategy.Strategy): diff --git a/glance/notifier/notify_qpid.py b/glance/notifier/notify_qpid.py index f0bd511da7..72c0db7427 100644 --- a/glance/notifier/notify_qpid.py +++ b/glance/notifier/notify_qpid.py @@ -15,12 +15,12 @@ import json -import logging import qpid.messaging from glance.notifier import strategy from glance.openstack.common import cfg +import glance.openstack.common.log as logging LOG = logging.getLogger(__name__) diff --git a/glance/registry/__init__.py b/glance/registry/__init__.py index f095d2b1af..e9b7350c34 100644 --- a/glance/registry/__init__.py +++ b/glance/registry/__init__.py @@ -19,11 +19,11 @@ Registry API """ -import logging import os from glance.common import exception from glance.openstack.common import cfg +import glance.openstack.common.log as logging from glance.registry import client LOG = logging.getLogger(__name__) diff --git a/glance/registry/api/v1/images.py b/glance/registry/api/v1/images.py index b722c6db0d..beb70f097c 100644 --- a/glance/registry/api/v1/images.py +++ b/glance/registry/api/v1/images.py @@ -19,8 +19,6 @@ Reference implementation registry server WSGI controller """ -import logging - from webob import exc from glance.common import exception @@ -28,6 +26,7 @@ from glance.common import utils from glance.common import wsgi import glance.db from glance.openstack.common import cfg +import glance.openstack.common.log as logging from glance.openstack.common import timeutils diff --git a/glance/registry/api/v1/members.py b/glance/registry/api/v1/members.py index c0efce711c..e5409e99fe 100644 --- a/glance/registry/api/v1/members.py +++ b/glance/registry/api/v1/members.py @@ -15,14 +15,13 @@ # License for the specific language governing permissions and limitations # under the License. -import logging - import webob.exc from glance.common import exception from glance.common import utils from glance.common import wsgi import glance.db +import glance.openstack.common.log as logging LOG = logging.getLogger(__name__) diff --git a/glance/store/__init__.py b/glance/store/__init__.py index 0c2824ea46..369f37e403 100644 --- a/glance/store/__init__.py +++ b/glance/store/__init__.py @@ -15,7 +15,6 @@ # License for the specific language governing permissions and limitations # under the License. -import logging import os import sys import time @@ -24,6 +23,7 @@ from glance.common import exception from glance.common import utils from glance.openstack.common import cfg from glance.openstack.common import importutils +import glance.openstack.common.log as logging from glance import registry from glance.store import location diff --git a/glance/store/base.py b/glance/store/base.py index 706d5a96d9..0d8c76bb4f 100644 --- a/glance/store/base.py +++ b/glance/store/base.py @@ -17,10 +17,9 @@ """Base class for all storage backends""" -import logging - from glance.common import exception from glance.openstack.common import importutils +import glance.openstack.common.log as logging LOG = logging.getLogger(__name__) diff --git a/glance/store/filesystem.py b/glance/store/filesystem.py index 200a84d2bb..3fa229a099 100644 --- a/glance/store/filesystem.py +++ b/glance/store/filesystem.py @@ -21,13 +21,13 @@ A simple filesystem-backed store import errno import hashlib -import logging import os import urlparse from glance.common import exception from glance.common import utils from glance.openstack.common import cfg +import glance.openstack.common.log as logging import glance.store import glance.store.base import glance.store.location diff --git a/glance/store/http.py b/glance/store/http.py index c2d1d00d04..35c6b4829f 100644 --- a/glance/store/http.py +++ b/glance/store/http.py @@ -16,10 +16,10 @@ # under the License. import httplib -import logging import urlparse from glance.common import exception +import glance.openstack.common.log as logging import glance.store.base import glance.store.location diff --git a/glance/store/location.py b/glance/store/location.py index 9b88330c86..72197ab518 100644 --- a/glance/store/location.py +++ b/glance/store/location.py @@ -39,11 +39,11 @@ that it stores in its storage backends. It **does contain** security credentials and is **not** user-facing. """ -import logging import urlparse from glance.common import exception from glance.common import utils +import glance.openstack.common.log as logging LOG = logging.getLogger(__name__) diff --git a/glance/store/rbd.py b/glance/store/rbd.py index e63341fae2..fe9e419e1e 100644 --- a/glance/store/rbd.py +++ b/glance/store/rbd.py @@ -21,11 +21,11 @@ from __future__ import absolute_import from __future__ import with_statement import hashlib -import logging import math from glance.common import exception from glance.openstack.common import cfg +import glance.openstack.common.log as logging import glance.store import glance.store.base import glance.store.location diff --git a/glance/store/s3.py b/glance/store/s3.py index 062e522593..ab1186cad4 100644 --- a/glance/store/s3.py +++ b/glance/store/s3.py @@ -19,7 +19,6 @@ import hashlib import httplib -import logging import re import tempfile import urlparse @@ -27,6 +26,7 @@ import urlparse from glance.common import exception from glance.common import utils from glance.openstack.common import cfg +import glance.openstack.common.log as logging import glance.store import glance.store.base import glance.store.location diff --git a/glance/store/scrubber.py b/glance/store/scrubber.py index 39132a55ee..be49b2a9d4 100644 --- a/glance/store/scrubber.py +++ b/glance/store/scrubber.py @@ -17,12 +17,12 @@ import calendar import eventlet -import logging import os import time from glance.common import utils from glance.openstack.common import cfg +import glance.openstack.common.log as logging from glance import registry from glance.registry import client from glance import store diff --git a/glance/store/swift.py b/glance/store/swift.py index a07623ace8..c325bf396d 100644 --- a/glance/store/swift.py +++ b/glance/store/swift.py @@ -21,13 +21,13 @@ from __future__ import absolute_import import hashlib import httplib -import logging import math import urllib import urlparse from glance.common import exception from glance.openstack.common import cfg +import glance.openstack.common.log as logging import glance.store import glance.store.base import glance.store.location diff --git a/glance/tests/unit/test_notifier.py b/glance/tests/unit/test_notifier.py index 783f2c3db8..61fc523b0b 100644 --- a/glance/tests/unit/test_notifier.py +++ b/glance/tests/unit/test_notifier.py @@ -15,8 +15,6 @@ # License for the specific language governing permissions and limitations # under the License. -import logging - import kombu.entity import mox try: @@ -30,6 +28,7 @@ from glance.common import exception from glance import notifier import glance.notifier.notify_kombu from glance.openstack.common import importutils +import glance.openstack.common.log as logging from glance.tests import utils diff --git a/glance/tests/unit/utils.py b/glance/tests/unit/utils.py index 51cceab590..502a4b6f80 100644 --- a/glance/tests/unit/utils.py +++ b/glance/tests/unit/utils.py @@ -13,12 +13,11 @@ # License for the specific language governing permissions and limitations # under the License. -import logging - from glance.common import exception from glance.common import wsgi import glance.context import glance.db.simple.api as simple_db +import glance.openstack.common.log as logging LOG = logging.getLogger(__name__) diff --git a/tools/migrate_image_owners.py b/tools/migrate_image_owners.py index e0ea02c977..4a7a3b394f 100644 --- a/tools/migrate_image_owners.py +++ b/tools/migrate_image_owners.py @@ -1,12 +1,12 @@ #!/usr/bin/python -import logging import sys import keystoneclient.v2_0.client import glance.context from glance.openstack.common import cfg +import glance.openstack.common.log as logging import glance.registry.context import glance.db.sqlalchemy.api as db_api