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