Python 3 deprecated the logger.warn method in favor of 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. Closes-Bug: 1508442 Change-Id: I245d24b30e783f1c6dcec1b425d78d271edff49b
This commit is contained in:
parent
a859b00596
commit
6ac4ce2eb1
|
@ -89,7 +89,7 @@ class CertManager(cert_manager.CertManager):
|
|||
cert_ref = str(uuid.uuid4())
|
||||
filename_base = os.path.join(CONF.certificates.storage_path, cert_ref)
|
||||
|
||||
LOG.warn(_LW(
|
||||
LOG.warning(_LW(
|
||||
"Storing certificate data on the local filesystem. "
|
||||
"CertManager type 'local' should be used for testing purpose."
|
||||
))
|
||||
|
@ -127,7 +127,7 @@ class CertManager(cert_manager.CertManager):
|
|||
representation of the certificate data
|
||||
:raises CertificateStorageException: if certificate retrieval fails
|
||||
"""
|
||||
LOG.warn(_LW(
|
||||
LOG.warning(_LW(
|
||||
"Loading certificate {0} from the local filesystem. "
|
||||
"CertManager type 'local' should be used for testing purpose."
|
||||
).format(cert_ref))
|
||||
|
@ -188,7 +188,7 @@ class CertManager(cert_manager.CertManager):
|
|||
|
||||
:raises CertificateStorageException: if certificate deletion fails
|
||||
"""
|
||||
LOG.warn(_LW(
|
||||
LOG.warning(_LW(
|
||||
"Deleting certificate {0} from the local filesystem. "
|
||||
"CertManager type 'local' should be used for testing purpose."
|
||||
).format(cert_ref))
|
||||
|
|
|
@ -92,7 +92,7 @@ class KeystoneClientV3(object):
|
|||
elif self.context.auth_token_info:
|
||||
kwargs['token'] = self.context.auth_token
|
||||
if self._is_v2_valid(self.context.auth_token_info):
|
||||
LOG.warn('Keystone v2 is deprecated.')
|
||||
LOG.warning('Keystone v2 is deprecated.')
|
||||
kwargs['auth_ref'] = self.context.auth_token_info['access']
|
||||
kwargs['auth_ref']['version'] = 'v2.0'
|
||||
elif self._is_v3_valid(self.context.auth_token_info):
|
||||
|
|
|
@ -406,8 +406,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):
|
||||
|
@ -415,8 +415,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):
|
||||
|
@ -431,9 +431,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):
|
||||
|
@ -445,8 +445,10 @@ 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
|
||||
|
|
|
@ -150,4 +150,4 @@ def delete_certificates_from_bay(bay):
|
|||
cert_manager.get_backend().CertManager.delete_cert(
|
||||
cert_ref, resource_ref=bay.uuid)
|
||||
except Exception:
|
||||
LOG.warn(_LW("Deleting cert is failed: %s") % cert_ref)
|
||||
LOG.warning(_LW("Deleting cert is failed: %s") % cert_ref)
|
||||
|
|
|
@ -51,10 +51,10 @@ class SwarmMonitor(MonitorBase):
|
|||
try:
|
||||
container = docker.inspect_container(container['Id'])
|
||||
except Exception as e:
|
||||
LOG.warn(_LW("Ignore error [%(e)s] when inspecting "
|
||||
"container %(container_id)s."),
|
||||
{'e': e, 'container_id': container['Id']},
|
||||
exc_info=True)
|
||||
LOG.warning(_LW("Ignore error [%(e)s] when inspecting "
|
||||
"container %(container_id)s."),
|
||||
{'e': e, 'container_id': container['Id']},
|
||||
exc_info=True)
|
||||
containers.append(container)
|
||||
self.data['containers'] = containers
|
||||
|
||||
|
|
|
@ -98,8 +98,9 @@ class MagnumPeriodicTasks(periodic_task.PeriodicTasks):
|
|||
self._sync_missing_heat_stack(bay)
|
||||
|
||||
except Exception as e:
|
||||
LOG.warn(_LW("Ignore error [%s] when syncing up bay status."), e,
|
||||
exc_info=True)
|
||||
LOG.warning(_LW(
|
||||
"Ignore error [%s] when syncing up bay status."
|
||||
), e, exc_info=True)
|
||||
|
||||
def _sync_existing_bay(self, bay, stack):
|
||||
if bay.status != stack.stack_status:
|
||||
|
@ -158,9 +159,9 @@ class MagnumPeriodicTasks(periodic_task.PeriodicTasks):
|
|||
try:
|
||||
monitor.pull_data()
|
||||
except Exception as e:
|
||||
LOG.warn(_LW("Skip pulling data from bay %(bay)s due to "
|
||||
"error: %(e)s"),
|
||||
{'e': e, 'bay': bay.uuid}, exc_info=True)
|
||||
LOG.warning(_LW("Skip pulling data from bay %(bay)s due to "
|
||||
"error: %(e)s"),
|
||||
{'e': e, 'bay': bay.uuid}, exc_info=True)
|
||||
continue
|
||||
|
||||
metrics = list()
|
||||
|
@ -173,9 +174,9 @@ class MagnumPeriodicTasks(periodic_task.PeriodicTasks):
|
|||
}
|
||||
metrics.append(metric)
|
||||
except Exception as e:
|
||||
LOG.warn(_LW("Skip adding metric %(name)s due to "
|
||||
"error: %(e)s"),
|
||||
{'e': e, 'name': name}, exc_info=True)
|
||||
LOG.warning(_LW("Skip adding metric %(name)s due to "
|
||||
"error: %(e)s"),
|
||||
{'e': e, 'name': name}, exc_info=True)
|
||||
|
||||
message = dict(metrics=metrics,
|
||||
user_id=bay.user_id,
|
||||
|
|
Loading…
Reference in New Issue