Change LOG.warn to LOG.warning

Python 3 deprecated the logger.warn method, see:
https://docs.python.org/3/library/logging.html#logging.warning
so we prefer to use warning to avoid DeprecationWarning.

Change-Id: I6e925af4568062fa294e0f1c67b506cd06671bd6
Closes-Bug: #1530742
This commit is contained in:
zhangguoqing 2016-01-04 13:17:26 +00:00
parent 409f63eda8
commit f274731dfa
1 changed files with 10 additions and 9 deletions

View File

@ -442,8 +442,8 @@ def unlink_without_raise(path):
if e.errno == errno.ENOENT:
return
else:
LOG.warn(_LW("Failed to unlink %(path)s, error: %(e)s"),
{'path': path, 'e': e})
LOG.warning(_LW("Failed to unlink %(path)s, error: %(e)s"),
{'path': path, 'e': e})
def rmtree_without_raise(path):
@ -451,8 +451,8 @@ def rmtree_without_raise(path):
if os.path.isdir(path):
shutil.rmtree(path)
except OSError as e:
LOG.warn(_LW("Failed to remove dir %(path)s, error: %(e)s"),
{'path': path, 'e': e})
LOG.warning(_LW("Failed to remove dir %(path)s, error: %(e)s"),
{'path': path, 'e': e})
def write_to_file(path, contents):
@ -467,9 +467,9 @@ def create_link_without_raise(source, link):
if e.errno == errno.EEXIST:
return
else:
LOG.warn(_LW("Failed to create symlink from %(source)s to %(link)s"
", error: %(e)s"),
{'source': source, 'link': link, 'e': e})
LOG.warning(_LW("Failed to create symlink from %(source)s to "
"%(link)s, error: %(e)s"),
{'source': source, 'link': link, 'e': e})
def safe_rstrip(value, chars=None):
@ -481,8 +481,9 @@ def safe_rstrip(value, chars=None):
"""
if not isinstance(value, six.string_types):
LOG.warn(_LW("Failed to remove trailing character. Returning original "
"object. Supplied object is not a string: %s,"), value)
LOG.warning(_LW("Failed to remove trailing character. Returning "
"original object. Supplied object is not a string: "
"%s,"), value)
return value
return value.rstrip(chars) or value