Python 3 deprecated the logger.warn method in favor of warning
According to https://docs.python.org/3/library/logging.html#logging.warning, We prefer to use warning to avoid DeprecationWarning. Change-Id: I29e960b3ba179e0701a57aee84cff6bdf4105db5
This commit is contained in:
parent
342b0913b4
commit
a89ac06029
@ -95,9 +95,9 @@ class RetryDecorator(object):
|
||||
result = f(*args, **kwargs)
|
||||
except self._exceptions:
|
||||
with excutils.save_and_reraise_exception() as ctxt:
|
||||
LOG.warn(_LW("Exception which is in the suggested list of "
|
||||
"exceptions occurred while invoking function:"
|
||||
" %s."),
|
||||
LOG.warning(_LW("Exception which is in the suggested list "
|
||||
"of exceptions occurred while invoking "
|
||||
"function: %s."),
|
||||
func_name,
|
||||
exc_info=True)
|
||||
if (self._max_retry_count != -1 and
|
||||
@ -494,7 +494,7 @@ class VMwareAPISession(object):
|
||||
lease,
|
||||
'error')
|
||||
except exceptions.VimException:
|
||||
LOG.warn(_LW("Error occurred while reading error message for "
|
||||
LOG.warning(_LW("Error occurred while reading error message for "
|
||||
"lease: %s."),
|
||||
lease,
|
||||
exc_info=True)
|
||||
|
@ -79,7 +79,8 @@ class FixedIntervalLoopingCall(LoopingCallBase):
|
||||
break
|
||||
delay = interval - timeutils.delta_seconds(start, end)
|
||||
if delay <= 0:
|
||||
LOG.warn(_LW('task run outlasted interval by %s sec'),
|
||||
LOG.warning(_LW('task run outlasted interval '
|
||||
'by %s sec'),
|
||||
-delay)
|
||||
greenthread.sleep(delay if delay > 0 else 0)
|
||||
except LoopingCallDone as e:
|
||||
|
@ -168,7 +168,7 @@ class ImageTransferException(VMwareDriverException):
|
||||
|
||||
|
||||
def _print_deprecation_warning(clazz):
|
||||
LOG.warn(_LW("Exception %s is deprecated, it will be removed in the "
|
||||
LOG.warning(_LW("Exception %s is deprecated, it will be removed in the "
|
||||
"next release."), clazz.__name__)
|
||||
|
||||
|
||||
|
@ -196,7 +196,7 @@ def get_pbm_wsdl_location(vc_version):
|
||||
pbm_service_wsdl = os.path.join(curr_dir, 'wsdl', major_minor,
|
||||
'pbmService.wsdl')
|
||||
if not os.path.exists(pbm_service_wsdl):
|
||||
LOG.warn(_LW("PBM WSDL file %s not found."), pbm_service_wsdl)
|
||||
LOG.warning(_LW("PBM WSDL file %s not found."), pbm_service_wsdl)
|
||||
return
|
||||
pbm_wsdl = urlparse.urljoin('file:', urllib.pathname2url(pbm_service_wsdl))
|
||||
LOG.debug("Using PBM WSDL location: %s.", pbm_wsdl)
|
||||
|
@ -152,7 +152,7 @@ class FileHandle(object):
|
||||
try:
|
||||
self._file_handle.close()
|
||||
except Exception:
|
||||
LOG.warn(_LW("Error occurred while closing the file handle"),
|
||||
LOG.warning(_LW("Error occurred while closing the file handle"),
|
||||
exc_info=True)
|
||||
|
||||
def _build_vim_cookie_header(self, vim_cookies):
|
||||
@ -300,7 +300,7 @@ class FileWriteHandle(FileHandle):
|
||||
try:
|
||||
self._conn.getresponse()
|
||||
except Exception:
|
||||
LOG.warn(_LW("Error occurred while reading the HTTP response."),
|
||||
LOG.warning(_LW("Error occurred while reading the HTTP response."),
|
||||
exc_info=True)
|
||||
super(FileWriteHandle, self).close()
|
||||
|
||||
@ -473,7 +473,8 @@ class VmdkWriteHandle(FileHandle):
|
||||
{'url': self._url,
|
||||
'state': state})
|
||||
except exceptions.VimException:
|
||||
LOG.warn(_LW("Error occurred while releasing the lease for %s."),
|
||||
LOG.warning(_LW("Error occurred while releasing the lease "
|
||||
"for %s."),
|
||||
self._url,
|
||||
exc_info=True)
|
||||
super(VmdkWriteHandle, self).close()
|
||||
@ -611,7 +612,8 @@ class VmdkReadHandle(FileHandle):
|
||||
{'url': self._url,
|
||||
'state': state})
|
||||
except exceptions.VimException:
|
||||
LOG.warn(_LW("Error occurred while releasing the lease for %s."),
|
||||
LOG.warning(_LW("Error occurred while releasing the lease "
|
||||
"for %s."),
|
||||
self._url,
|
||||
exc_info=True)
|
||||
raise
|
||||
|
Loading…
Reference in New Issue
Block a user