Run pyupgrade to clean up Python 2 syntaxes
Update all .py source files by $ pyupgrade --py3-only $(git ls-files | grep ".py$") to modernize the code according to Python 3 syntaxes. pep8 errors are fixed by $ autopep8 --select=E127,E128,E501 --max-line-length 79 -r \ --in-place oslo_vmware Also add the pyupgrade hook to pre-commit to avoid merging additional Python 2 syntaxes. Change-Id: I1b34f8026d69db4485b2eec03767e54331e7817c
This commit is contained in:
@@ -28,3 +28,8 @@ repos:
|
|||||||
hooks:
|
hooks:
|
||||||
- id: bandit
|
- id: bandit
|
||||||
args: ['-x', 'tests']
|
args: ['-x', 'tests']
|
||||||
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
|
rev: v3.18.0
|
||||||
|
hooks:
|
||||||
|
- id: pyupgrade
|
||||||
|
args: [--py3-only]
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright (C) 2020 Red Hat, Inc.
|
# Copyright (C) 2020 Red Hat, Inc.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@@ -46,7 +46,7 @@ def _trunc_id(session_id):
|
|||||||
|
|
||||||
|
|
||||||
# TODO(vbala) Move this class to excutils.py.
|
# TODO(vbala) Move this class to excutils.py.
|
||||||
class RetryDecorator(object):
|
class RetryDecorator:
|
||||||
"""Decorator for retrying a function upon suggested exceptions.
|
"""Decorator for retrying a function upon suggested exceptions.
|
||||||
|
|
||||||
The decorated function is retried for the given number of times, and the
|
The decorated function is retried for the given number of times, and the
|
||||||
@@ -124,7 +124,7 @@ class RetryDecorator(object):
|
|||||||
return func
|
return func
|
||||||
|
|
||||||
|
|
||||||
class VMwareAPISession(object):
|
class VMwareAPISession:
|
||||||
"""Setup a session with the server and handles all calls made to it.
|
"""Setup a session with the server and handles all calls made to it.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
@@ -43,7 +43,7 @@ class LoopingCallDone(Exception):
|
|||||||
self.retvalue = retvalue
|
self.retvalue = retvalue
|
||||||
|
|
||||||
|
|
||||||
class LoopingCallBase(object):
|
class LoopingCallBase:
|
||||||
def __init__(self, f=None, *args, **kw):
|
def __init__(self, f=None, *args, **kw):
|
||||||
self.args = args
|
self.args = args
|
||||||
self.kw = kw
|
self.kw = kw
|
||||||
|
@@ -82,7 +82,7 @@ class VMwareDriverException(Exception):
|
|||||||
message = self.msg_fmt
|
message = self.msg_fmt
|
||||||
|
|
||||||
self.message = message
|
self.message = message
|
||||||
super(VMwareDriverException, self).__init__(message)
|
super().__init__(message)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def msg(self):
|
def msg(self):
|
||||||
@@ -103,7 +103,7 @@ class VimException(VMwareDriverException):
|
|||||||
"""The base exception class for all VIM related exceptions."""
|
"""The base exception class for all VIM related exceptions."""
|
||||||
|
|
||||||
def __init__(self, message=None, cause=None, details=None, **kwargs):
|
def __init__(self, message=None, cause=None, details=None, **kwargs):
|
||||||
super(VimException, self).__init__(message, details, **kwargs)
|
super().__init__(message, details, **kwargs)
|
||||||
self.cause = cause
|
self.cause = cause
|
||||||
|
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ class VimSessionOverLoadException(VMwareDriverException):
|
|||||||
"""Thrown when there is an API call overload at the VMware server."""
|
"""Thrown when there is an API call overload at the VMware server."""
|
||||||
|
|
||||||
def __init__(self, message, cause=None):
|
def __init__(self, message, cause=None):
|
||||||
super(VimSessionOverLoadException, self).__init__(message)
|
super().__init__(message)
|
||||||
self.cause = cause
|
self.cause = cause
|
||||||
|
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@ class VimConnectionException(VMwareDriverException):
|
|||||||
"""Thrown when there is a connection problem."""
|
"""Thrown when there is a connection problem."""
|
||||||
|
|
||||||
def __init__(self, message, cause=None):
|
def __init__(self, message, cause=None):
|
||||||
super(VimConnectionException, self).__init__(message)
|
super().__init__(message)
|
||||||
self.cause = cause
|
self.cause = cause
|
||||||
|
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ class VimAttributeException(VMwareDriverException):
|
|||||||
"""Thrown when a particular attribute cannot be found."""
|
"""Thrown when a particular attribute cannot be found."""
|
||||||
|
|
||||||
def __init__(self, message, cause=None):
|
def __init__(self, message, cause=None):
|
||||||
super(VimAttributeException, self).__init__(message)
|
super().__init__(message)
|
||||||
self.cause = cause
|
self.cause = cause
|
||||||
|
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ class VimFaultException(VimException):
|
|||||||
"""Exception thrown when there are unrecognized VIM faults."""
|
"""Exception thrown when there are unrecognized VIM faults."""
|
||||||
|
|
||||||
def __init__(self, fault_list, message, cause=None, details=None):
|
def __init__(self, fault_list, message, cause=None, details=None):
|
||||||
super(VimFaultException, self).__init__(message, cause, details)
|
super().__init__(message, cause, details)
|
||||||
if not isinstance(fault_list, list):
|
if not isinstance(fault_list, list):
|
||||||
raise ValueError(_("fault_list must be a list"))
|
raise ValueError(_("fault_list must be a list"))
|
||||||
self.fault_list = fault_list
|
self.fault_list = fault_list
|
||||||
@@ -148,7 +148,7 @@ class VimFaultException(VimException):
|
|||||||
descr += '\nFaults: ' + str(self.fault_list)
|
descr += '\nFaults: ' + str(self.fault_list)
|
||||||
if self.details:
|
if self.details:
|
||||||
# details may contain non-ASCII values
|
# details may contain non-ASCII values
|
||||||
details = '{%s}' % ', '.join(["'%s': '%s'" % (k, v) for k, v in
|
details = '{%s}' % ', '.join(["'{}': '{}'".format(k, v) for k, v in
|
||||||
self.details.items()])
|
self.details.items()])
|
||||||
descr += '\nDetails: ' + details
|
descr += '\nDetails: ' + details
|
||||||
return descr
|
return descr
|
||||||
@@ -158,7 +158,7 @@ class ImageTransferException(VMwareDriverException):
|
|||||||
"""Thrown when there is an error during image transfer."""
|
"""Thrown when there is an error during image transfer."""
|
||||||
|
|
||||||
def __init__(self, message, cause=None):
|
def __init__(self, message, cause=None):
|
||||||
super(ImageTransferException, self).__init__(message)
|
super().__init__(message)
|
||||||
self.cause = cause
|
self.cause = cause
|
||||||
|
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ class VMwareDriverConfigurationException(VMwareDriverException):
|
|||||||
msg_fmt = _("VMware Driver configuration fault.")
|
msg_fmt = _("VMware Driver configuration fault.")
|
||||||
|
|
||||||
def __init__(self, message=None, details=None, **kwargs):
|
def __init__(self, message=None, details=None, **kwargs):
|
||||||
super(VMwareDriverConfigurationException, self).__init__(
|
super().__init__(
|
||||||
message, details, **kwargs)
|
message, details, **kwargs)
|
||||||
_print_deprecation_warning(self.__class__)
|
_print_deprecation_warning(self.__class__)
|
||||||
|
|
||||||
@@ -186,7 +186,7 @@ class MissingParameter(VMwareDriverException):
|
|||||||
msg_fmt = _("Missing parameter : %(param)s")
|
msg_fmt = _("Missing parameter : %(param)s")
|
||||||
|
|
||||||
def __init__(self, message=None, details=None, **kwargs):
|
def __init__(self, message=None, details=None, **kwargs):
|
||||||
super(MissingParameter, self).__init__(message, details, **kwargs)
|
super().__init__(message, details, **kwargs)
|
||||||
_print_deprecation_warning(self.__class__)
|
_print_deprecation_warning(self.__class__)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -24,10 +24,10 @@ _all_log_levels = {'critical', 'error', 'exception', 'info',
|
|||||||
_all_hints = {'_'}
|
_all_hints = {'_'}
|
||||||
|
|
||||||
_log_translation_hint = re.compile(
|
_log_translation_hint = re.compile(
|
||||||
r".*LOG\.(%(levels)s)\(\s*(%(hints)s)\(" % {
|
r".*LOG\.({levels})\(\s*({hints})\(".format(
|
||||||
'levels': '|'.join(_all_log_levels),
|
levels='|'.join(_all_log_levels),
|
||||||
'hints': '|'.join(_all_hints),
|
hints='|'.join(_all_hints),
|
||||||
})
|
))
|
||||||
|
|
||||||
|
|
||||||
@core.flake8ext
|
@core.flake8ext
|
||||||
|
@@ -106,7 +106,7 @@ def download_image(image, image_meta, session, datastore, rel_path,
|
|||||||
conn = ds_url.connect(method, image_size, cookie)
|
conn = ds_url.connect(method, image_size, cookie)
|
||||||
else:
|
else:
|
||||||
ds_url = datastore.build_url(session._scheme, session._host, rel_path)
|
ds_url = datastore.build_url(session._scheme, session._host, rel_path)
|
||||||
cookie = '%s=%s' % (constants.SOAP_COOKIE_KEY,
|
cookie = '{}={}'.format(constants.SOAP_COOKIE_KEY,
|
||||||
session.vim.get_http_cookie().strip("\""))
|
session.vim.get_http_cookie().strip("\""))
|
||||||
conn = ds_url.connect(method, image_size, cookie)
|
conn = ds_url.connect(method, image_size, cookie)
|
||||||
conn.write = conn.send
|
conn.write = conn.send
|
||||||
|
@@ -19,10 +19,10 @@ from defusedxml.lxml import parse
|
|||||||
def _get_vmdk_name_from_ovf(root):
|
def _get_vmdk_name_from_ovf(root):
|
||||||
ns_ovf = "{{{0}}}".format(root.nsmap["ovf"])
|
ns_ovf = "{{{0}}}".format(root.nsmap["ovf"])
|
||||||
disk = root.find("./{0}DiskSection/{0}Disk".format(ns_ovf))
|
disk = root.find("./{0}DiskSection/{0}Disk".format(ns_ovf))
|
||||||
file_id = disk.get("{0}fileRef".format(ns_ovf))
|
file_id = disk.get("{}fileRef".format(ns_ovf))
|
||||||
f = root.find('./{0}References/{0}File[@{0}id="{1}"]'.format(ns_ovf,
|
f = root.find('./{0}References/{0}File[@{0}id="{1}"]'.format(ns_ovf,
|
||||||
file_id))
|
file_id))
|
||||||
return f.get("{0}href".format(ns_ovf))
|
return f.get("{}href".format(ns_ovf))
|
||||||
|
|
||||||
|
|
||||||
def get_vmdk_name_from_ovf(ovf_handle):
|
def get_vmdk_name_from_ovf(ovf_handle):
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
from oslo_vmware._i18n import _
|
from oslo_vmware._i18n import _
|
||||||
|
|
||||||
|
|
||||||
class Datacenter(object):
|
class Datacenter:
|
||||||
|
|
||||||
def __init__(self, ref, name):
|
def __init__(self, ref, name):
|
||||||
"""Datacenter object holds ref and name together for convenience."""
|
"""Datacenter object holds ref and name together for convenience."""
|
||||||
|
@@ -149,7 +149,7 @@ def sdrs_enabled(session, dsc_ref):
|
|||||||
return pod_sdrs_entry.storageDrsConfig.podConfig.enabled
|
return pod_sdrs_entry.storageDrsConfig.podConfig.enabled
|
||||||
|
|
||||||
|
|
||||||
class Datastore(object):
|
class Datastore:
|
||||||
|
|
||||||
def __init__(self, ref, name, capacity=None, freespace=None,
|
def __init__(self, ref, name, capacity=None, freespace=None,
|
||||||
uncommitted=None, type=None, datacenter=None):
|
uncommitted=None, type=None, datacenter=None):
|
||||||
@@ -276,7 +276,7 @@ class Datastore(object):
|
|||||||
return hosts[i]
|
return hosts[i]
|
||||||
|
|
||||||
|
|
||||||
class DatastorePath(object):
|
class DatastorePath:
|
||||||
|
|
||||||
"""Class for representing a directory or file path in a vSphere datatore.
|
"""Class for representing a directory or file path in a vSphere datatore.
|
||||||
|
|
||||||
@@ -312,7 +312,7 @@ class DatastorePath(object):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
"""Full datastore path to the file or directory."""
|
"""Full datastore path to the file or directory."""
|
||||||
if self._rel_path != '':
|
if self._rel_path != '':
|
||||||
return "[%s] %s" % (self._datastore_name, self.rel_path)
|
return "[{}] {}".format(self._datastore_name, self.rel_path)
|
||||||
return "[%s]" % self._datastore_name
|
return "[%s]" % self._datastore_name
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -372,7 +372,7 @@ class DatastorePath(object):
|
|||||||
return cls(datastore_name, path.strip())
|
return cls(datastore_name, path.strip())
|
||||||
|
|
||||||
|
|
||||||
class DatastoreURL(object):
|
class DatastoreURL:
|
||||||
|
|
||||||
"""Class for representing a URL to HTTP access a file in a datastore.
|
"""Class for representing a URL to HTTP access a file in a datastore.
|
||||||
|
|
||||||
@@ -420,7 +420,7 @@ class DatastoreURL(object):
|
|||||||
return self._datastore_name
|
return self._datastore_name
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '%s://%s/folder/%s?%s' % (self._scheme, self._server,
|
return '{}://{}/folder/{}?{}'.format(self._scheme, self._server,
|
||||||
self.path, self._query)
|
self.path, self._query)
|
||||||
|
|
||||||
def connect(self, method, content_length, cookie):
|
def connect(self, method, content_length, cookie):
|
||||||
@@ -434,7 +434,8 @@ class DatastoreURL(object):
|
|||||||
excep_msg = _("Invalid scheme: %s.") % self._scheme
|
excep_msg = _("Invalid scheme: %s.") % self._scheme
|
||||||
LOG.error(excep_msg)
|
LOG.error(excep_msg)
|
||||||
raise ValueError(excep_msg)
|
raise ValueError(excep_msg)
|
||||||
conn.putrequest(method, '/folder/%s?%s' % (self.path, self._query))
|
conn.putrequest(
|
||||||
|
method, '/folder/{}?{}'.format(self.path, self._query))
|
||||||
conn.putheader('User-Agent', constants.USER_AGENT)
|
conn.putheader('User-Agent', constants.USER_AGENT)
|
||||||
conn.putheader('Content-Length', content_length)
|
conn.putheader('Content-Length', content_length)
|
||||||
conn.putheader('Cookie', cookie)
|
conn.putheader('Cookie', cookie)
|
||||||
@@ -458,4 +459,4 @@ class DatastoreURL(object):
|
|||||||
'AcquireGenericServiceTicket',
|
'AcquireGenericServiceTicket',
|
||||||
session.vim.service_content.sessionManager,
|
session.vim.service_content.sessionManager,
|
||||||
spec=spec)
|
spec=spec)
|
||||||
return '%s="%s"' % (constants.CGI_COOKIE_KEY, ticket.id)
|
return '{}="{}"'.format(constants.CGI_COOKIE_KEY, ticket.id)
|
||||||
|
@@ -59,7 +59,7 @@ class Pbm(service.Service):
|
|||||||
"""
|
"""
|
||||||
base_url = service.Service.build_base_url(protocol, host, port)
|
base_url = service.Service.build_base_url(protocol, host, port)
|
||||||
soap_url = base_url + '/pbm'
|
soap_url = base_url + '/pbm'
|
||||||
super(Pbm, self).__init__(wsdl_url, soap_url, cacert, insecure,
|
super().__init__(wsdl_url, soap_url, cacert, insecure,
|
||||||
pool_maxsize, connection_timeout,
|
pool_maxsize, connection_timeout,
|
||||||
op_id_prefix)
|
op_id_prefix)
|
||||||
|
|
||||||
@@ -193,7 +193,7 @@ def get_pbm_wsdl_location(vc_version):
|
|||||||
ver = vc_version.split('.')
|
ver = vc_version.split('.')
|
||||||
major_minor = ver[0]
|
major_minor = ver[0]
|
||||||
if len(ver) >= 2:
|
if len(ver) >= 2:
|
||||||
major_minor = '%s.%s' % (major_minor, ver[1])
|
major_minor = '{}.{}'.format(major_minor, ver[1])
|
||||||
curr_dir = os.path.abspath(os.path.dirname(__file__))
|
curr_dir = os.path.abspath(os.path.dirname(__file__))
|
||||||
pbm_service_wsdl = os.path.join(curr_dir, 'wsdl', major_minor,
|
pbm_service_wsdl = os.path.join(curr_dir, 'wsdl', major_minor,
|
||||||
'pbmService.wsdl')
|
'pbmService.wsdl')
|
||||||
|
@@ -44,7 +44,7 @@ READ_CHUNKSIZE = 65536
|
|||||||
USER_AGENT = 'OpenStack-ESX-Adapter'
|
USER_AGENT = 'OpenStack-ESX-Adapter'
|
||||||
|
|
||||||
|
|
||||||
class FileHandle(object):
|
class FileHandle:
|
||||||
"""Base class for VMware server file (including VMDK) access over HTTP.
|
"""Base class for VMware server file (including VMDK) access over HTTP.
|
||||||
|
|
||||||
This class wraps a backing file handle and provides utility methods
|
This class wraps a backing file handle and provides utility methods
|
||||||
@@ -184,7 +184,7 @@ class FileHandle(object):
|
|||||||
"""returns the integer file descriptor
|
"""returns the integer file descriptor
|
||||||
by default this is not supported and raises IOError
|
by default this is not supported and raises IOError
|
||||||
"""
|
"""
|
||||||
raise IOError()
|
raise OSError()
|
||||||
|
|
||||||
def seek(self, offset):
|
def seek(self, offset):
|
||||||
"""sets the file's current position at the offset
|
"""sets the file's current position at the offset
|
||||||
@@ -243,7 +243,7 @@ class FileWriteHandle(FileHandle):
|
|||||||
else:
|
else:
|
||||||
soap_url = self._get_soap_url(scheme, host_or_url, port)
|
soap_url = self._get_soap_url(scheme, host_or_url, port)
|
||||||
param_list = {'dcPath': data_center_name, 'dsName': datastore_name}
|
param_list = {'dcPath': data_center_name, 'dsName': datastore_name}
|
||||||
self._url = '%s/folder/%s' % (soap_url, file_path)
|
self._url = '{}/folder/{}'.format(soap_url, file_path)
|
||||||
self._url = self._url + '?' + urlparse.urlencode(param_list)
|
self._url = self._url + '?' + urlparse.urlencode(param_list)
|
||||||
|
|
||||||
self._conn = self._create_write_connection('PUT',
|
self._conn = self._create_write_connection('PUT',
|
||||||
@@ -284,7 +284,7 @@ class FileWriteHandle(FileHandle):
|
|||||||
except Exception:
|
except Exception:
|
||||||
LOG.warning("Error occurred while reading the HTTP response.",
|
LOG.warning("Error occurred while reading the HTTP response.",
|
||||||
exc_info=True)
|
exc_info=True)
|
||||||
super(FileWriteHandle, self).close()
|
super().close()
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "File write handle for %s" % self._url
|
return "File write handle for %s" % self._url
|
||||||
@@ -319,7 +319,7 @@ class FileReadHandle(FileHandle):
|
|||||||
else:
|
else:
|
||||||
soap_url = self._get_soap_url(scheme, host_or_url, port)
|
soap_url = self._get_soap_url(scheme, host_or_url, port)
|
||||||
param_list = {'dcPath': data_center_name, 'dsName': datastore_name}
|
param_list = {'dcPath': data_center_name, 'dsName': datastore_name}
|
||||||
self._url = '%s/folder/%s' % (soap_url, file_path)
|
self._url = '{}/folder/{}'.format(soap_url, file_path)
|
||||||
self._url = self._url + '?' + urlparse.urlencode(param_list)
|
self._url = self._url + '?' + urlparse.urlencode(param_list)
|
||||||
|
|
||||||
self._conn = self._create_read_connection(self._url,
|
self._conn = self._create_read_connection(self._url,
|
||||||
@@ -353,7 +353,7 @@ class FileReadHandle(FileHandle):
|
|||||||
"""Closes the connection.
|
"""Closes the connection.
|
||||||
"""
|
"""
|
||||||
self._conn.close()
|
self._conn.close()
|
||||||
super(FileReadHandle, self).close()
|
super().close()
|
||||||
LOG.debug("Closed File read handle for %s.", self._url)
|
LOG.debug("Closed File read handle for %s.", self._url)
|
||||||
|
|
||||||
def get_size(self):
|
def get_size(self):
|
||||||
@@ -373,7 +373,7 @@ class VmdkHandle(FileHandle):
|
|||||||
self._last_logged_progress = 0
|
self._last_logged_progress = 0
|
||||||
self._last_progress_udpate = 0
|
self._last_progress_udpate = 0
|
||||||
|
|
||||||
super(VmdkHandle, self).__init__(file_handle)
|
super().__init__(file_handle)
|
||||||
|
|
||||||
def _log_progress(self, progress):
|
def _log_progress(self, progress):
|
||||||
"""Log data transfer progress."""
|
"""Log data transfer progress."""
|
||||||
@@ -586,7 +586,7 @@ class VmdkWriteHandle(VmdkHandle):
|
|||||||
overwrite=overwrite,
|
overwrite=overwrite,
|
||||||
content_type=content_type,
|
content_type=content_type,
|
||||||
ssl_thumbprint=thumbprint)
|
ssl_thumbprint=thumbprint)
|
||||||
super(VmdkWriteHandle, self).__init__(session, lease, url, self._conn)
|
super().__init__(session, lease, url, self._conn)
|
||||||
|
|
||||||
def get_imported_vm(self):
|
def get_imported_vm(self):
|
||||||
""""Get managed object reference of the VM created for import.
|
""""Get managed object reference of the VM created for import.
|
||||||
@@ -642,7 +642,7 @@ class VmdkWriteHandle(VmdkHandle):
|
|||||||
"for %s.",
|
"for %s.",
|
||||||
self._url,
|
self._url,
|
||||||
exc_info=True)
|
exc_info=True)
|
||||||
super(VmdkWriteHandle, self).close()
|
super().close()
|
||||||
LOG.debug("Closed VMDK write handle for %s.", self._url)
|
LOG.debug("Closed VMDK write handle for %s.", self._url)
|
||||||
|
|
||||||
def _get_progress(self):
|
def _get_progress(self):
|
||||||
@@ -685,7 +685,7 @@ class VmdkReadHandle(VmdkHandle):
|
|||||||
self._conn = self._create_read_connection(url,
|
self._conn = self._create_read_connection(url,
|
||||||
cookies=cookies,
|
cookies=cookies,
|
||||||
ssl_thumbprint=thumbprint)
|
ssl_thumbprint=thumbprint)
|
||||||
super(VmdkReadHandle, self).__init__(session, lease, url,
|
super().__init__(session, lease, url,
|
||||||
self._conn.getresponse())
|
self._conn.getresponse())
|
||||||
|
|
||||||
def read(self, chunk_size=READ_CHUNKSIZE):
|
def read(self, chunk_size=READ_CHUNKSIZE):
|
||||||
@@ -731,7 +731,7 @@ class VmdkReadHandle(VmdkHandle):
|
|||||||
exc_info=True)
|
exc_info=True)
|
||||||
raise
|
raise
|
||||||
finally:
|
finally:
|
||||||
super(VmdkReadHandle, self).close()
|
super().close()
|
||||||
LOG.debug("Closed VMDK read handle for %s.", self._url)
|
LOG.debug("Closed VMDK read handle for %s.", self._url)
|
||||||
|
|
||||||
def _get_progress(self):
|
def _get_progress(self):
|
||||||
@@ -741,7 +741,7 @@ class VmdkReadHandle(VmdkHandle):
|
|||||||
return "VMDK read handle for %s" % self._url
|
return "VMDK read handle for %s" % self._url
|
||||||
|
|
||||||
|
|
||||||
class ImageReadHandle(object):
|
class ImageReadHandle:
|
||||||
"""Read handle for glance images."""
|
"""Read handle for glance images."""
|
||||||
|
|
||||||
def __init__(self, glance_read_iter):
|
def __init__(self, glance_read_iter):
|
||||||
@@ -767,8 +767,7 @@ class ImageReadHandle(object):
|
|||||||
|
|
||||||
def get_next(self):
|
def get_next(self):
|
||||||
"""Get the next item from the image iterator."""
|
"""Get the next item from the image iterator."""
|
||||||
for data in self._glance_read_iter:
|
yield from self._glance_read_iter
|
||||||
yield data
|
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
"""Close the read handle.
|
"""Close the read handle.
|
||||||
|
@@ -138,7 +138,7 @@ class LocalFileAdapter(requests.adapters.HTTPAdapter):
|
|||||||
See http://stackoverflow.com/a/22989322
|
See http://stackoverflow.com/a/22989322
|
||||||
"""
|
"""
|
||||||
def __init__(self, pool_maxsize=10):
|
def __init__(self, pool_maxsize=10):
|
||||||
super(LocalFileAdapter, self).__init__(pool_connections=pool_maxsize,
|
super().__init__(pool_connections=pool_maxsize,
|
||||||
pool_maxsize=pool_maxsize)
|
pool_maxsize=pool_maxsize)
|
||||||
|
|
||||||
def _build_response_from_file(self, request):
|
def _build_response_from_file(self, request):
|
||||||
@@ -216,7 +216,7 @@ class CompatibilitySudsClient(client.Client):
|
|||||||
underlying transport.
|
underlying transport.
|
||||||
"""
|
"""
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(CompatibilitySudsClient, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def cookiejar(self):
|
def cookiejar(self):
|
||||||
@@ -228,7 +228,7 @@ class CompatibilitySudsClient(client.Client):
|
|||||||
self.options.transport.cookiejar = cookies
|
self.options.transport.cookiejar = cookies
|
||||||
|
|
||||||
|
|
||||||
class Service(object):
|
class Service:
|
||||||
"""Base class containing common functionality for invoking vSphere
|
"""Base class containing common functionality for invoking vSphere
|
||||||
services
|
services
|
||||||
"""
|
"""
|
||||||
@@ -366,7 +366,7 @@ class Service(object):
|
|||||||
if not skip_op_id:
|
if not skip_op_id:
|
||||||
# Generate opID. It will appear in vCenter and ESX logs for
|
# Generate opID. It will appear in vCenter and ESX logs for
|
||||||
# this particular remote call.
|
# this particular remote call.
|
||||||
op_id = '%s-%s' % (self.op_id_prefix,
|
op_id = '{}-{}'.format(self.op_id_prefix,
|
||||||
uuidutils.generate_uuid())
|
uuidutils.generate_uuid())
|
||||||
LOG.debug('Invoking %s.%s with opID=%s',
|
LOG.debug('Invoking %s.%s with opID=%s',
|
||||||
vim_util.get_moref_type(managed_object),
|
vim_util.get_moref_type(managed_object),
|
||||||
|
@@ -30,7 +30,7 @@ class TestCase(testtools.TestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""Run before each test method to initialize test environment."""
|
"""Run before each test method to initialize test environment."""
|
||||||
|
|
||||||
super(TestCase, self).setUp()
|
super().setUp()
|
||||||
test_timeout = os.environ.get('OS_TEST_TIMEOUT', 0)
|
test_timeout = os.environ.get('OS_TEST_TIMEOUT', 0)
|
||||||
try:
|
try:
|
||||||
test_timeout = int(test_timeout)
|
test_timeout = int(test_timeout)
|
||||||
|
@@ -23,14 +23,14 @@ from oslo_vmware.tests import base
|
|||||||
from oslo_vmware import vim_util
|
from oslo_vmware import vim_util
|
||||||
|
|
||||||
|
|
||||||
class HostMount(object):
|
class HostMount:
|
||||||
|
|
||||||
def __init__(self, key, mountInfo):
|
def __init__(self, key, mountInfo):
|
||||||
self.key = key
|
self.key = key
|
||||||
self.mountInfo = mountInfo
|
self.mountInfo = mountInfo
|
||||||
|
|
||||||
|
|
||||||
class MountInfo(object):
|
class MountInfo:
|
||||||
|
|
||||||
def __init__(self, accessMode, mounted, accessible):
|
def __init__(self, accessMode, mounted, accessible):
|
||||||
self.accessMode = accessMode
|
self.accessMode = accessMode
|
||||||
@@ -111,21 +111,21 @@ class DatastoreTestCase(base.TestCase):
|
|||||||
m4 = HostMount("m4", MountInfo('readWrite', True, False))
|
m4 = HostMount("m4", MountInfo('readWrite', True, False))
|
||||||
ds.get_summary.assert_called_once_with(session)
|
ds.get_summary.assert_called_once_with(session)
|
||||||
|
|
||||||
class Prop(object):
|
class Prop:
|
||||||
DatastoreHostMount = [m1, m2, m3, m4]
|
DatastoreHostMount = [m1, m2, m3, m4]
|
||||||
|
|
||||||
class HostRuntime(object):
|
class HostRuntime:
|
||||||
inMaintenanceMode = in_maintenance_mode
|
inMaintenanceMode = in_maintenance_mode
|
||||||
|
|
||||||
class HostProp(object):
|
class HostProp:
|
||||||
name = 'runtime'
|
name = 'runtime'
|
||||||
val = HostRuntime()
|
val = HostRuntime()
|
||||||
|
|
||||||
class Object(object):
|
class Object:
|
||||||
obj = "m1"
|
obj = "m1"
|
||||||
propSet = [HostProp()]
|
propSet = [HostProp()]
|
||||||
|
|
||||||
class Runtime(object):
|
class Runtime:
|
||||||
objects = [Object()]
|
objects = [Object()]
|
||||||
|
|
||||||
session.invoke_api = mock.Mock(side_effect=[Prop(), Runtime()])
|
session.invoke_api = mock.Mock(side_effect=[Prop(), Runtime()])
|
||||||
@@ -366,7 +366,7 @@ class DatastoreURLTestCase(base.TestCase):
|
|||||||
params = {'dcPath': dc_path, 'dsName': ds_name}
|
params = {'dcPath': dc_path, 'dsName': ds_name}
|
||||||
query = urlparse.urlencode(params)
|
query = urlparse.urlencode(params)
|
||||||
url = datastore.DatastoreURL(scheme, server, path, dc_path, ds_name)
|
url = datastore.DatastoreURL(scheme, server, path, dc_path, ds_name)
|
||||||
expected_url = '%s://%s/folder/%s?%s' % (
|
expected_url = '{}://{}/folder/{}?{}'.format(
|
||||||
scheme, server, path, query)
|
scheme, server, path, query)
|
||||||
self.assertEqual(expected_url, str(url))
|
self.assertEqual(expected_url, str(url))
|
||||||
|
|
||||||
@@ -379,7 +379,7 @@ class DatastoreURLTestCase(base.TestCase):
|
|||||||
params = {'dcPath': dc_path, 'dsName': ds_name}
|
params = {'dcPath': dc_path, 'dsName': ds_name}
|
||||||
query = urlparse.urlencode(params)
|
query = urlparse.urlencode(params)
|
||||||
url = datastore.DatastoreURL(scheme, server, path, dc_path, ds_name)
|
url = datastore.DatastoreURL(scheme, server, path, dc_path, ds_name)
|
||||||
expected_url = '%s://%s/folder/%s?%s' % (
|
expected_url = '{}://{}/folder/{}?{}'.format(
|
||||||
scheme, server, path.lstrip('/'), query)
|
scheme, server, path.lstrip('/'), query)
|
||||||
self.assertEqual(expected_url, str(url))
|
self.assertEqual(expected_url, str(url))
|
||||||
|
|
||||||
@@ -392,7 +392,7 @@ class DatastoreURLTestCase(base.TestCase):
|
|||||||
params = {'dcPath': dc_path, 'dsName': ds_name}
|
params = {'dcPath': dc_path, 'dsName': ds_name}
|
||||||
query = urlparse.urlencode(params)
|
query = urlparse.urlencode(params)
|
||||||
url = datastore.DatastoreURL(scheme, server, path, dc_path, ds_name)
|
url = datastore.DatastoreURL(scheme, server, path, dc_path, ds_name)
|
||||||
expected_url = '%s://%s/folder/%s?%s' % (
|
expected_url = '{}://{}/folder/{}?{}'.format(
|
||||||
scheme, server, path.rstrip('/'), query)
|
scheme, server, path.rstrip('/'), query)
|
||||||
self.assertEqual(expected_url, str(url))
|
self.assertEqual(expected_url, str(url))
|
||||||
|
|
||||||
@@ -429,7 +429,7 @@ class DatastoreURLTestCase(base.TestCase):
|
|||||||
params = {'dcPath': dc_path, 'dsName': ds_name}
|
params = {'dcPath': dc_path, 'dsName': ds_name}
|
||||||
path = 'images/aa.vmdk'
|
path = 'images/aa.vmdk'
|
||||||
query = urlparse.urlencode(params)
|
query = urlparse.urlencode(params)
|
||||||
url = 'https://13.37.73.31/folder/%s?%s' % (path, query)
|
url = 'https://13.37.73.31/folder/{}?{}'.format(path, query)
|
||||||
ds_url = datastore.DatastoreURL.urlparse(url)
|
ds_url = datastore.DatastoreURL.urlparse(url)
|
||||||
self.assertEqual(path, ds_url.path)
|
self.assertEqual(path, ds_url.path)
|
||||||
|
|
||||||
@@ -454,12 +454,12 @@ class DatastoreURLTestCase(base.TestCase):
|
|||||||
session = mock.Mock()
|
session = mock.Mock()
|
||||||
session.invoke_api = mock.Mock()
|
session.invoke_api = mock.Mock()
|
||||||
|
|
||||||
class Ticket(object):
|
class Ticket:
|
||||||
id = 'fake_id'
|
id = 'fake_id'
|
||||||
session.invoke_api.return_value = Ticket()
|
session.invoke_api.return_value = Ticket()
|
||||||
ds_url = datastore.DatastoreURL.urlparse(url)
|
ds_url = datastore.DatastoreURL.urlparse(url)
|
||||||
ticket = ds_url.get_transfer_ticket(session, 'PUT')
|
ticket = ds_url.get_transfer_ticket(session, 'PUT')
|
||||||
self.assertEqual('%s="%s"' % (constants.CGI_COOKIE_KEY, 'fake_id'),
|
self.assertEqual('{}="{}"'.format(constants.CGI_COOKIE_KEY, 'fake_id'),
|
||||||
ticket)
|
ticket)
|
||||||
|
|
||||||
def test_get_datastore_by_ref(self):
|
def test_get_datastore_by_ref(self):
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
# coding=utf-8
|
|
||||||
# Copyright (c) 2014 VMware, Inc.
|
# Copyright (c) 2014 VMware, Inc.
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
@@ -105,7 +104,7 @@ class VMwareAPISessionTest(base.TestCase):
|
|||||||
POOL_SIZE = 15
|
POOL_SIZE = 15
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(VMwareAPISessionTest, self).setUp()
|
super().setUp()
|
||||||
patcher = mock.patch('oslo_vmware.vim.Vim')
|
patcher = mock.patch('oslo_vmware.vim.Vim')
|
||||||
self.addCleanup(patcher.stop)
|
self.addCleanup(patcher.stop)
|
||||||
self.VimMock = patcher.start()
|
self.VimMock = patcher.start()
|
||||||
@@ -318,7 +317,7 @@ class VMwareAPISessionTest(base.TestCase):
|
|||||||
api_session = self._create_api_session(True)
|
api_session = self._create_api_session(True)
|
||||||
fault_string = 'Invalid property.'
|
fault_string = 'Invalid property.'
|
||||||
fault_list = [exceptions.INVALID_PROPERTY]
|
fault_list = [exceptions.INVALID_PROPERTY]
|
||||||
details = {u'name': suds.sax.text.Text(u'фира')}
|
details = {'name': suds.sax.text.Text('фира')}
|
||||||
|
|
||||||
module = mock.Mock()
|
module = mock.Mock()
|
||||||
module.api.side_effect = exceptions.VimFaultException(fault_list,
|
module.api.side_effect = exceptions.VimFaultException(fault_list,
|
||||||
@@ -328,8 +327,8 @@ class VMwareAPISessionTest(base.TestCase):
|
|||||||
api_session.invoke_api,
|
api_session.invoke_api,
|
||||||
module,
|
module,
|
||||||
'api')
|
'api')
|
||||||
details_str = u"{'name': 'фира'}"
|
details_str = "{'name': 'фира'}"
|
||||||
expected_str = "%s\nFaults: %s\nDetails: %s" % (fault_string,
|
expected_str = "{}\nFaults: {}\nDetails: {}".format(fault_string,
|
||||||
fault_list,
|
fault_list,
|
||||||
details_str)
|
details_str)
|
||||||
self.assertEqual(expected_str, str(e))
|
self.assertEqual(expected_str, str(e))
|
||||||
|
@@ -22,8 +22,8 @@ class HackingTestCase(base.TestCase):
|
|||||||
def test_no_log_translations(self):
|
def test_no_log_translations(self):
|
||||||
for log, hint in itertools.product(checks._all_log_levels,
|
for log, hint in itertools.product(checks._all_log_levels,
|
||||||
checks._all_hints):
|
checks._all_hints):
|
||||||
bad = 'LOG.%s(%s("Bad"))' % (log, hint)
|
bad = 'LOG.{}({}("Bad"))'.format(log, hint)
|
||||||
self.assertEqual(1, len(list(checks.no_translate_logs(bad, 'f'))))
|
self.assertEqual(1, len(list(checks.no_translate_logs(bad, 'f'))))
|
||||||
# Catch abuses when used with a variable and not a literal
|
# Catch abuses when used with a variable and not a literal
|
||||||
bad = 'LOG.%s(%s(msg))' % (log, hint)
|
bad = 'LOG.{}({}(msg))'.format(log, hint)
|
||||||
self.assertEqual(1, len(list(checks.no_translate_logs(bad, 'f'))))
|
self.assertEqual(1, len(list(checks.no_translate_logs(bad, 'f'))))
|
||||||
|
@@ -97,7 +97,7 @@ class FileWriteHandleTest(base.TestCase):
|
|||||||
"""Tests for FileWriteHandle."""
|
"""Tests for FileWriteHandle."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(FileWriteHandleTest, self).setUp()
|
super().setUp()
|
||||||
|
|
||||||
vim_cookie = mock.Mock()
|
vim_cookie = mock.Mock()
|
||||||
vim_cookie.name = 'name'
|
vim_cookie.name = 'name'
|
||||||
@@ -188,7 +188,7 @@ class VmdkWriteHandleTest(base.TestCase):
|
|||||||
"""Tests for VmdkWriteHandle."""
|
"""Tests for VmdkWriteHandle."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(VmdkWriteHandleTest, self).setUp()
|
super().setUp()
|
||||||
self._conn = mock.Mock()
|
self._conn = mock.Mock()
|
||||||
patcher = mock.patch(
|
patcher = mock.patch(
|
||||||
'urllib3.connection.HTTPConnection')
|
'urllib3.connection.HTTPConnection')
|
||||||
@@ -308,7 +308,7 @@ class VmdkReadHandleTest(base.TestCase):
|
|||||||
"""Tests for VmdkReadHandle."""
|
"""Tests for VmdkReadHandle."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(VmdkReadHandleTest, self).setUp()
|
super().setUp()
|
||||||
|
|
||||||
def _mock_connection(self, read_data='fake-data'):
|
def _mock_connection(self, read_data='fake-data'):
|
||||||
self._resp = mock.Mock()
|
self._resp = mock.Mock()
|
||||||
@@ -436,7 +436,7 @@ class ImageReadHandleTest(base.TestCase):
|
|||||||
max_items = 10
|
max_items = 10
|
||||||
item = [1] * 10
|
item = [1] * 10
|
||||||
|
|
||||||
class ImageReadIterator(object):
|
class ImageReadIterator:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.num_items = 0
|
self.num_items = 0
|
||||||
|
@@ -32,7 +32,7 @@ class ServiceMessagePluginTest(base.TestCase):
|
|||||||
"""Test class for ServiceMessagePlugin."""
|
"""Test class for ServiceMessagePlugin."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(ServiceMessagePluginTest, self).setUp()
|
super().setUp()
|
||||||
self.plugin = service.ServiceMessagePlugin()
|
self.plugin = service.ServiceMessagePlugin()
|
||||||
|
|
||||||
@ddt.data(('value', 'foo', 'string'), ('removeKey', '1', 'int'),
|
@ddt.data(('value', 'foo', 'string'), ('removeKey', '1', 'int'),
|
||||||
@@ -59,7 +59,7 @@ class ServiceMessagePluginTest(base.TestCase):
|
|||||||
class ServiceTest(base.TestCase):
|
class ServiceTest(base.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(ServiceTest, self).setUp()
|
super().setUp()
|
||||||
patcher = mock.patch('oslo_vmware.service.CompatibilitySudsClient')
|
patcher = mock.patch('oslo_vmware.service.CompatibilitySudsClient')
|
||||||
self.addCleanup(patcher.stop)
|
self.addCleanup(patcher.stop)
|
||||||
self.SudsClientMock = patcher.start()
|
self.SudsClientMock = patcher.start()
|
||||||
@@ -536,7 +536,7 @@ class SudsLogFilterTest(base.TestCase):
|
|||||||
"""Tests for SudsLogFilter."""
|
"""Tests for SudsLogFilter."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(SudsLogFilterTest, self).setUp()
|
super().setUp()
|
||||||
self.log_filter = service.SudsLogFilter()
|
self.log_filter = service.SudsLogFilter()
|
||||||
|
|
||||||
self.login = mock.Mock(spec=suds.sax.element.Element)
|
self.login = mock.Mock(spec=suds.sax.element.Element)
|
||||||
|
@@ -30,7 +30,7 @@ class VimTest(base.TestCase):
|
|||||||
"""Test class for Vim."""
|
"""Test class for Vim."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(VimTest, self).setUp()
|
super().setUp()
|
||||||
patcher = mock.patch('oslo_vmware.service.CompatibilitySudsClient')
|
patcher = mock.patch('oslo_vmware.service.CompatibilitySudsClient')
|
||||||
self.addCleanup(patcher.stop)
|
self.addCleanup(patcher.stop)
|
||||||
self.SudsClientMock = patcher.start()
|
self.SudsClientMock = patcher.start()
|
||||||
@@ -78,7 +78,7 @@ class VimTest(base.TestCase):
|
|||||||
|
|
||||||
class VMwareSudsTest(base.TestCase):
|
class VMwareSudsTest(base.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(VMwareSudsTest, self).setUp()
|
super().setUp()
|
||||||
|
|
||||||
def new_client_init(self, url, **kwargs):
|
def new_client_init(self, url, **kwargs):
|
||||||
return
|
return
|
||||||
@@ -89,7 +89,7 @@ class VMwareSudsTest(base.TestCase):
|
|||||||
self.vim = self._vim_create()
|
self.vim = self._vim_create()
|
||||||
|
|
||||||
def _mock_getattr(self, attr_name):
|
def _mock_getattr(self, attr_name):
|
||||||
class fake_service_content(object):
|
class fake_service_content:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ServiceContent = {}
|
self.ServiceContent = {}
|
||||||
self.ServiceContent.fake = 'fake'
|
self.ServiceContent.fake = 'fake'
|
||||||
|
@@ -44,7 +44,7 @@ class Vim(service.Service):
|
|||||||
soap_url = base_url + '/sdk'
|
soap_url = base_url + '/sdk'
|
||||||
if wsdl_url is None:
|
if wsdl_url is None:
|
||||||
wsdl_url = soap_url + '/vimService.wsdl'
|
wsdl_url = soap_url + '/vimService.wsdl'
|
||||||
super(Vim, self).__init__(wsdl_url, soap_url, cacert, insecure,
|
super().__init__(wsdl_url, soap_url, cacert, insecure,
|
||||||
pool_maxsize, connection_timeout,
|
pool_maxsize, connection_timeout,
|
||||||
op_id_prefix)
|
op_id_prefix)
|
||||||
|
|
||||||
|
@@ -433,7 +433,7 @@ def continue_retrieval(vim, retrieve_result):
|
|||||||
return vim.ContinueRetrievePropertiesEx(collector, token=token)
|
return vim.ContinueRetrievePropertiesEx(collector, token=token)
|
||||||
|
|
||||||
|
|
||||||
class WithRetrieval(object):
|
class WithRetrieval:
|
||||||
"""Context to retrieve results.
|
"""Context to retrieve results.
|
||||||
|
|
||||||
This context provides an iterator to retrieve results and cancel (when
|
This context provides an iterator to retrieve results and cancel (when
|
||||||
@@ -447,7 +447,7 @@ class WithRetrieval(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, vim, retrieve_result):
|
def __init__(self, vim, retrieve_result):
|
||||||
super(WithRetrieval, self).__init__()
|
super().__init__()
|
||||||
self.vim = vim
|
self.vim = vim
|
||||||
self.retrieve_result = retrieve_result
|
self.retrieve_result = retrieve_result
|
||||||
|
|
||||||
@@ -460,8 +460,7 @@ class WithRetrieval(object):
|
|||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
while self.retrieve_result:
|
while self.retrieve_result:
|
||||||
for obj in self.retrieve_result.objects:
|
yield from self.retrieve_result.objects
|
||||||
yield obj
|
|
||||||
self.retrieve_result = continue_retrieval(
|
self.retrieve_result = continue_retrieval(
|
||||||
self.vim, self.retrieve_result)
|
self.vim, self.retrieve_result)
|
||||||
|
|
||||||
@@ -577,13 +576,13 @@ def get_inventory_path(vim, entity_ref, max_objects=100):
|
|||||||
if len(propSet) >= 1 and not entity_name:
|
if len(propSet) >= 1 and not entity_name:
|
||||||
entity_name = propSet[0].val
|
entity_name = propSet[0].val
|
||||||
elif len(propSet) >= 1:
|
elif len(propSet) >= 1:
|
||||||
path = '%s/%s' % (propSet[0].val, path)
|
path = '{}/{}'.format(propSet[0].val, path)
|
||||||
# NOTE(arnaud): slice to exclude the root folder from the result.
|
# NOTE(arnaud): slice to exclude the root folder from the result.
|
||||||
if propSet is not None and len(propSet) > 0:
|
if propSet is not None and len(propSet) > 0:
|
||||||
path = path[len(propSet[0].val):]
|
path = path[len(propSet[0].val):]
|
||||||
if entity_name is None:
|
if entity_name is None:
|
||||||
entity_name = ""
|
entity_name = ""
|
||||||
return '%s%s' % (path, entity_name)
|
return '{}{}'.format(path, entity_name)
|
||||||
|
|
||||||
|
|
||||||
def get_http_service_request_spec(client_factory, method, uri):
|
def get_http_service_request_spec(client_factory, method, uri):
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright (C) 2020 Red Hat, Inc.
|
# Copyright (C) 2020 Red Hat, Inc.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
Reference in New Issue
Block a user