Use logging.warning instead of logging.warn

logging.warn() is deprecated in Python 3 [1]. While it is not in
the short-term list of priorities for Packstack, it does not hurt
to use logging.warning [2], which is forward-compatible.

Closes-Bug: 1508442

[1]https://docs.python.org/3/library/logging.html#logging.warning
[2]https://docs.python.org/2/library/logging.html#logging.warning

Change-Id: I7c13513720280415350a83fd6ed0636af476a20e
This commit is contained in:
Javier Pena 2016-01-07 15:54:08 +01:00
parent 28e74215ad
commit 765653f7a4
3 changed files with 5 additions and 5 deletions

View File

@ -81,7 +81,7 @@ def host2ip(hostname, allow_localhost=False):
raise NameError("Host %s is not routable, please fix"
"your /etc/hosts", host)
if len(routable) > 1:
logging.warn("Multiple IPs for host detected!")
logging.warning("Multiple IPs for host detected!")
ip = routable[0]
_host_cache[key] = ip

View File

@ -939,7 +939,7 @@ def detect_os_and_version(host):
out = out.split(",")
return out
except exceptions.ScriptRuntimeError:
logging.warn('Could not detect OS release')
logging.warning('Could not detect OS release')
return ['Unknown', 'Unknown']
@ -1122,7 +1122,7 @@ def manage_epel(host, config):
msg += 'This is OK in case you don\'t want EPEL installed and enabled.'
# TO-DO: fill logger name when logging will be refactored.
logger = logging.getLogger()
logger.warn(msg % host)
logger.warning(msg % host)
def manage_rdo(host, config):

View File

@ -74,7 +74,7 @@ class FakePopen(object):
if args in self.cmd_registry:
this = self.cmd_registry[args]
else:
LOG.warn('call to unregistered command: %s', cmd)
LOG.warning('call to unregistered command: %s', cmd)
this = {'stdout': '', 'stderr': '', 'returncode': 0}
self.stdout = this['stdout']
@ -89,7 +89,7 @@ class FakePopen(object):
if input in self.script_registry:
this = self.script_registry[input]
else:
LOG.warn('call to unregistered script: %s', input)
LOG.warning('call to unregistered script: %s', input)
this = {'stdout': '', 'stderr': '', 'returncode': 0}
self.stdout = this['stdout']
self.stderr = this['stderr']