LOG.warn is deprecated in python3

Replace LOG.warn with LOG.warning cause it has been
deprecated in py3 and oslo_lod is not used to
encapsulate this change.

Co-Authored-By: kairat_kushaev <kkushaev@mirantis.com>

Change-Id: I31b3f491b5d242abea4e5a7728983142ad2805a8
This commit is contained in:
skseeker 2016-02-01 22:59:00 +05:30 committed by Kairat Kushaev
parent 88c4a75366
commit d413f0d062
7 changed files with 16 additions and 14 deletions

View File

@ -211,8 +211,9 @@ class Store(glance_store.driver.Store):
# chmod g+x
os.chmod(datadir, mode | stat.S_IXGRP)
except (IOError, OSError):
LOG.warn(_LW("Unable to set execution permission of owner-group "
"and/or other-users to datadir: %s") % datadir)
LOG.warning(_LW("Unable to set execution permission of "
"owner-group and/or other-users to datadir: %s")
% datadir)
def _create_image_directories(self, directory_paths):
"""
@ -631,8 +632,8 @@ class Store(glance_store.driver.Store):
try:
os.chmod(filepath, perm)
except (IOError, OSError):
LOG.warn(_LW("Unable to set permission to image: %s") %
filepath)
LOG.warning(_LW("Unable to set permission to image: %s") %
filepath)
return ('file://%s' % filepath, bytes_written, checksum_hex, metadata)

View File

@ -147,8 +147,9 @@ def swift_retry_iter(resp_iter, length, store, location, context):
yield chunk
bytes_read += len(chunk)
except swiftclient.ClientException as e:
LOG.warn(_("Swift exception raised %s")
% encodeutils.exception_to_unicode(e))
LOG.warning(_("Swift exception raised %s")
% encodeutils.exception_to_unicode(e))
if bytes_read != length:
if retries == store.conf.glance_store.swift_store_retry_get_count:
@ -437,7 +438,7 @@ class BaseStore(driver.Store):
except swiftclient.ClientException as e:
if e.http_status == http_client.NOT_FOUND:
msg = _("Swift could not find object %s.") % location.obj
LOG.warn(msg)
LOG.warning(msg)
raise exceptions.NotFound(message=msg)
else:
raise

View File

@ -559,7 +559,7 @@ class Store(glance_store.Store):
self.session.wait_for_task(delete_task)
except vexc.FileNotFoundException:
msg = _('Image file %s not found') % file_path
LOG.warn(msg)
LOG.warning(msg)
raise exceptions.NotFound(message=msg)
except Exception:
with excutils.save_and_reraise_exception():

View File

@ -155,8 +155,8 @@ def _load_store(conf, store_entry, invoke_load=True):
invoke_on_load=invoke_load)
return mgr.driver
except RuntimeError as e:
LOG.warn("Failed to load driver %(driver)s."
"The driver will be disabled" % dict(driver=str([driver, e])))
LOG.warning("Failed to load driver %(driver)s. The "
"driver will be disabled" % dict(driver=str([driver, e])))
def _load_stores(conf):

View File

@ -215,8 +215,8 @@ def check(store_op_fun):
try:
req_cap = op_cap_map[op]
except KeyError:
LOG.warn(_LW('The capability of operation "%s" '
'could not be checked.'), op)
LOG.warning(_LW('The capability of operation "%s" '
'could not be checked.'), op)
else:
if not store.is_capable(*req_cap):
kwargs.setdefault('offset', 0)

View File

@ -69,7 +69,7 @@ class Store(capabilities.StoreCapability):
msg = (_(u"Failed to configure store correctly: %s "
"Disabling add method.")
% encodeutils.exception_to_unicode(e))
LOG.warn(msg)
LOG.warning(msg)
if re_raise_bsc:
raise
finally:

View File

@ -31,4 +31,4 @@ class TestStoreBase(base.StoreBaseTest):
self.config(stores=['file'], group='glance_store')
for (__, store_instance) in backend._load_stores(self.conf):
store_instance.configure()
self.assertTrue(mock_log.warn.called)
self.assertTrue(mock_log.warning.called)