pre-commit: Migrate from black to ruff format

This is mostly a case of adding trailing commas and rewrapping things to
fit on one line.

Change-Id: Iaabb38970e8077c3cfd19041c39e3d40d2d93ffa
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2024-08-29 11:29:24 +01:00
parent f83b657fc3
commit 187e88a559
69 changed files with 161 additions and 431 deletions

View File

@ -28,11 +28,7 @@ repos:
hooks: hooks:
- id: ruff - id: ruff
args: ['--fix'] args: ['--fix']
- repo: https://github.com/psf/black - id: ruff-format
rev: 24.8.0
hooks:
- id: black
args: ['-S', '-l', '79']
- repo: https://opendev.org/openstack/hacking - repo: https://opendev.org/openstack/hacking
rev: 7.0.0 rev: 7.0.0
hooks: hooks:

View File

@ -61,5 +61,5 @@ def assert_no_deprecated_exceptions(logical_line, filename):
'OpenStackCloudURINotFound', 'OpenStackCloudURINotFound',
'OpenStackCloudResourceNotFound', 'OpenStackCloudResourceNotFound',
): ):
if re.search(fr'\b{exception}\b', logical_line): if re.search(rf'\b{exception}\b', logical_line):
yield (0, 'O310: Use of deprecated Exception class') yield (0, 'O310: Use of deprecated Exception class')

View File

@ -73,7 +73,7 @@ class Deployable(resource.Resource):
json=request.body, json=request.body,
headers=request.headers, headers=request.headers,
microversion=microversion, microversion=microversion,
**kwargs **kwargs,
) )
self.microversion = microversion self.microversion = microversion
self._translate_response(response, has_body=has_body) self._translate_response(response, has_body=has_body)

View File

@ -14,7 +14,6 @@ from openstack.cloud import openstackcloud
class AcceleratorCloudMixin(openstackcloud._OpenStackCloudMixin): class AcceleratorCloudMixin(openstackcloud._OpenStackCloudMixin):
def list_deployables(self, filters=None): def list_deployables(self, filters=None):
"""List all available deployables. """List all available deployables.

View File

@ -42,7 +42,6 @@ def _normalize_port_list(nics):
class BaremetalCloudMixin(openstackcloud._OpenStackCloudMixin): class BaremetalCloudMixin(openstackcloud._OpenStackCloudMixin):
def list_nics(self): def list_nics(self):
"""Return a list of all bare metal ports.""" """Return a list of all bare metal ports."""
return list(self.baremetal.ports(details=True)) return list(self.baremetal.ports(details=True))
@ -187,7 +186,7 @@ class BaremetalCloudMixin(openstackcloud._OpenStackCloudMixin):
timeout=3600, timeout=3600,
lock_timeout=600, lock_timeout=600,
provision_state='available', provision_state='available',
**kwargs **kwargs,
): ):
"""Register Baremetal with Ironic """Register Baremetal with Ironic
@ -208,10 +207,7 @@ class BaremetalCloudMixin(openstackcloud._OpenStackCloudMixin):
Example:: Example::
[ [{'address': 'aa:bb:cc:dd:ee:01'}, {'address': 'aa:bb:cc:dd:ee:02'}]
{'address': 'aa:bb:cc:dd:ee:01'},
{'address': 'aa:bb:cc:dd:ee:02'}
]
Alternatively, you can provide an array of MAC addresses. Alternatively, you can provide an array of MAC addresses.
:param wait: Boolean value, defaulting to false, to wait for the node :param wait: Boolean value, defaulting to false, to wait for the node
@ -352,21 +348,16 @@ class BaremetalCloudMixin(openstackcloud._OpenStackCloudMixin):
Example patch construction:: Example patch construction::
patch=[] patch = []
patch.append({ patch.append({'op': 'remove', 'path': '/instance_info'})
'op': 'remove', patch.append({'op': 'replace', 'path': '/name', 'value': 'newname'})
'path': '/instance_info' patch.append(
}) {
patch.append({ 'op': 'add',
'op': 'replace', 'path': '/driver_info/username',
'path': '/name', 'value': 'administrator',
'value': 'newname' }
}) )
patch.append({
'op': 'add',
'path': '/driver_info/username',
'value': 'administrator'
})
:returns: Current state of the node. :returns: Current state of the node.
:rtype: :class:`~openstack.baremetal.v1.node.Node`. :rtype: :class:`~openstack.baremetal.v1.node.Node`.

View File

@ -19,7 +19,6 @@ from openstack import warnings as os_warnings
class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin): class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin):
# TODO(stephenfin): Remove 'cache' in a future major version # TODO(stephenfin): Remove 'cache' in a future major version
def list_volumes(self, cache=True): def list_volumes(self, cache=True):
"""List all available volumes. """List all available volumes.
@ -59,12 +58,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin):
further filtering. Elements of this dictionary may, themselves, be further filtering. Elements of this dictionary may, themselves, be
dictionaries. Example:: dictionaries. Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
@ -94,12 +88,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin):
further filtering. Elements of this dictionary may, themselves, be further filtering. Elements of this dictionary may, themselves, be
dictionaries. Example:: dictionaries. Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
@ -467,12 +456,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin):
further filtering. Elements of this dictionary may, themselves, be further filtering. Elements of this dictionary may, themselves, be
dictionaries. Example:: dictionaries. Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
@ -542,12 +526,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin):
further filtering. Elements of this dictionary may, themselves, be further filtering. Elements of this dictionary may, themselves, be
dictionaries. Example:: dictionaries. Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
@ -570,7 +549,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin):
{ {
'name': 'my-volume-snapshot', 'name': 'my-volume-snapshot',
'volume_id': 'e126044c-7b4c-43be-a32a-c9cbbc9ddb56', 'volume_id': 'e126044c-7b4c-43be-a32a-c9cbbc9ddb56',
'all_tenants': 1 'all_tenants': 1,
} }
:returns: A list of volume ``Snapshot`` objects. :returns: A list of volume ``Snapshot`` objects.
@ -590,7 +569,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin):
'name': 'my-volume-backup', 'name': 'my-volume-backup',
'status': 'available', 'status': 'available',
'volume_id': 'e126044c-7b4c-43be-a32a-c9cbbc9ddb56', 'volume_id': 'e126044c-7b4c-43be-a32a-c9cbbc9ddb56',
'all_tenants': 1 'all_tenants': 1,
} }
:returns: A list of volume ``Backup`` objects. :returns: A list of volume ``Backup`` objects.
@ -671,12 +650,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin):
further filtering. Elements of this dictionary may, themselves, be further filtering. Elements of this dictionary may, themselves, be
dictionaries. Example:: dictionaries. Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
@ -698,12 +672,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin):
further filtering. Elements of this dictionary may, themselves, be further filtering. Elements of this dictionary may, themselves, be
dictionaries. Example:: dictionaries. Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
@ -725,12 +694,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin):
further filtering. Elements of this dictionary may, themselves, be further filtering. Elements of this dictionary may, themselves, be
dictionaries. Example:: dictionaries. Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
@ -758,12 +722,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin):
further filtering. Elements of this dictionary may, themselves, be further filtering. Elements of this dictionary may, themselves, be
dictionaries. Example:: dictionaries. Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR

View File

@ -16,7 +16,6 @@ from openstack import exceptions
class CoeCloudMixin(openstackcloud._OpenStackCloudMixin): class CoeCloudMixin(openstackcloud._OpenStackCloudMixin):
def list_coe_clusters(self): def list_coe_clusters(self):
"""List COE (Container Orchestration Engine) cluster. """List COE (Container Orchestration Engine) cluster.
@ -51,12 +50,7 @@ class CoeCloudMixin(openstackcloud._OpenStackCloudMixin):
A dictionary of meta data to use for further filtering. Elements A dictionary of meta data to use for further filtering. Elements
of this dictionary may, themselves, be dictionaries. Example:: of this dictionary may, themselves, be dictionaries. Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
A string containing a jmespath expression for further filtering. A string containing a jmespath expression for further filtering.
@ -207,12 +201,7 @@ class CoeCloudMixin(openstackcloud._OpenStackCloudMixin):
A dictionary of meta data to use for further filtering. Elements A dictionary of meta data to use for further filtering. Elements
of this dictionary may, themselves, be dictionaries. Example:: of this dictionary may, themselves, be dictionaries. Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
A string containing a jmespath expression for further filtering. A string containing a jmespath expression for further filtering.

View File

@ -69,7 +69,6 @@ def _pop_or_get(resource, key, default, strict):
class ComputeCloudMixin(_network_common.NetworkCommonCloudMixin): class ComputeCloudMixin(_network_common.NetworkCommonCloudMixin):
@property @property
def _compute_region(self): def _compute_region(self):
# This is only used in exception messages. Can we get rid of it? # This is only used in exception messages. Can we get rid of it?
@ -398,12 +397,7 @@ class ComputeCloudMixin(_network_common.NetworkCommonCloudMixin):
Elements of this dictionary may, themselves, be dictionaries. Elements of this dictionary may, themselves, be dictionaries.
Example:: Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
A string containing a jmespath expression for further filtering. A string containing a jmespath expression for further filtering.
@ -421,12 +415,7 @@ class ComputeCloudMixin(_network_common.NetworkCommonCloudMixin):
Elements of this dictionary may, themselves, be dictionaries. Elements of this dictionary may, themselves, be dictionaries.
Example:: Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
A string containing a jmespath expression for further filtering. A string containing a jmespath expression for further filtering.
@ -505,12 +494,7 @@ class ComputeCloudMixin(_network_common.NetworkCommonCloudMixin):
A dictionary of meta data to use for further filtering. Elements A dictionary of meta data to use for further filtering. Elements
of this dictionary may, themselves, be dictionaries. Example:: of this dictionary may, themselves, be dictionaries. Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
A string containing a jmespath expression for further filtering. A string containing a jmespath expression for further filtering.
@ -1640,9 +1624,7 @@ class ComputeCloudMixin(_network_common.NetworkCommonCloudMixin):
{ {
'availability_zone': 'nova', 'availability_zone': 'nova',
'metadata': { 'metadata': {'cpu_allocation_ratio': '1.0'},
'cpu_allocation_ratio': '1.0'
}
} }
:returns: An aggregate dict or None if no matching aggregate is :returns: An aggregate dict or None if no matching aggregate is

View File

@ -17,7 +17,6 @@ from openstack import resource
class DnsCloudMixin(openstackcloud._OpenStackCloudMixin): class DnsCloudMixin(openstackcloud._OpenStackCloudMixin):
def list_zones(self, filters=None): def list_zones(self, filters=None):
"""List all available zones. """List all available zones.

View File

@ -20,7 +20,6 @@ from openstack import warnings as os_warnings
class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin): class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin):
def _get_project_id_param_dict(self, name_or_id): def _get_project_id_param_dict(self, name_or_id):
if name_or_id: if name_or_id:
project = self.get_project(name_or_id) project = self.get_project(name_or_id)
@ -73,12 +72,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin):
Elements of this dictionary may, themselves, be dictionaries. Elements of this dictionary may, themselves, be dictionaries.
Example:: Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
@ -114,12 +108,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin):
Elements of this dictionary may, themselves, be dictionaries. Elements of this dictionary may, themselves, be dictionaries.
Example:: Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
@ -141,12 +130,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin):
further filtering. Elements of this dictionary may, themselves, be further filtering. Elements of this dictionary may, themselves, be
dictionaries. Example:: dictionaries. Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
@ -264,12 +248,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin):
Elements of this dictionary may, themselves, be dictionaries. Elements of this dictionary may, themselves, be dictionaries.
Example:: Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
@ -304,12 +283,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin):
further filtering. Elements of this dictionary may, themselves, be further filtering. Elements of this dictionary may, themselves, be
dictionaries. Example:: dictionaries. Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
@ -506,12 +480,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin):
Elements of this dictionary may, themselves, be dictionaries. Elements of this dictionary may, themselves, be dictionaries.
Example:: Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
@ -675,12 +644,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin):
Elements of this dictionary may, themselves, be dictionaries. Elements of this dictionary may, themselves, be dictionaries.
Example:: Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
@ -837,12 +801,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin):
Elements of this dictionary may, themselves, be dictionaries. Elements of this dictionary may, themselves, be dictionaries.
Example:: Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
@ -875,12 +834,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin):
further filtering. Elements of this dictionary may, themselves, be further filtering. Elements of this dictionary may, themselves, be
dictionaries. Example:: dictionaries. Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
@ -919,12 +873,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin):
Elements of this dictionary may, themselves, be dictionaries. Elements of this dictionary may, themselves, be dictionaries.
Example:: Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
@ -1055,12 +1004,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin):
Elements of this dictionary may, themselves, be dictionaries. Elements of this dictionary may, themselves, be dictionaries.
Example:: Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR

View File

@ -17,7 +17,6 @@ from openstack import utils
class ImageCloudMixin(openstackcloud._OpenStackCloudMixin): class ImageCloudMixin(openstackcloud._OpenStackCloudMixin):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
@ -65,12 +64,7 @@ class ImageCloudMixin(openstackcloud._OpenStackCloudMixin):
Elements of this dictionary may, themselves, be dictionaries. Elements of this dictionary may, themselves, be dictionaries.
Example:: Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
A string containing a jmespath expression for further filtering. A string containing a jmespath expression for further filtering.

View File

@ -17,7 +17,6 @@ from openstack import exceptions
class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
def _neutron_extensions(self): def _neutron_extensions(self):
extensions = set() extensions = set()
for extension in self.network.extensions(): for extension in self.network.extensions():
@ -180,12 +179,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
Elements of this dictionary may, themselves, be dictionaries. Elements of this dictionary may, themselves, be dictionaries.
Example:: Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
A string containing a jmespath expression for further filtering. A string containing a jmespath expression for further filtering.
@ -254,12 +248,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
Elements of this dictionary may, themselves, be dictionaries. Elements of this dictionary may, themselves, be dictionaries.
Example:: Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
A string containing a jmespath expression for further filtering. A string containing a jmespath expression for further filtering.
@ -304,12 +293,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
Elements of this dictionary may, themselves, be dictionaries. Elements of this dictionary may, themselves, be dictionaries.
Example:: Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
A string containing a jmespath expression for further filtering. A string containing a jmespath expression for further filtering.
@ -340,12 +324,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
Elements of this dictionary may, themselves, be dictionaries. Elements of this dictionary may, themselves, be dictionaries.
Example:: Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
A string containing a jmespath expression for further filtering. A string containing a jmespath expression for further filtering.
@ -368,12 +347,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
Elements of this dictionary may, themselves, be dictionaries. Elements of this dictionary may, themselves, be dictionaries.
Example:: Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
:returns: A network ``Subnet`` object if found, else None. :returns: A network ``Subnet`` object if found, else None.
""" """
@ -400,12 +374,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
Elements of this dictionary may, themselves, be dictionaries. Elements of this dictionary may, themselves, be dictionaries.
Example:: Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
A string containing a jmespath expression for further filtering. A string containing a jmespath expression for further filtering.
@ -459,7 +428,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
:param bool external: Whether this network is externally accessible. :param bool external: Whether this network is externally accessible.
:param dict provider: A dict of network provider options. Example:: :param dict provider: A dict of network provider options. Example::
{ 'network_type': 'vlan', 'segmentation_id': 'vlan1' } {'network_type': 'vlan', 'segmentation_id': 'vlan1'}
:param string project_id: Specify the project ID this network :param string project_id: Specify the project ID this network
will be created on (admin-only). will be created on (admin-only).
@ -566,7 +535,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
:param bool external: Whether this network is externally accessible. :param bool external: Whether this network is externally accessible.
:param dict provider: A dict of network provider options. Example:: :param dict provider: A dict of network provider options. Example::
{ 'network_type': 'vlan', 'segmentation_id': 'vlan1' } {'network_type': 'vlan', 'segmentation_id': 'vlan1'}
:param int mtu_size: New maximum transmission unit value to address :param int mtu_size: New maximum transmission unit value to address
fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6. fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.
@ -753,12 +722,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
Elements of this dictionary may, themselves, be dictionaries. Elements of this dictionary may, themselves, be dictionaries.
Example:: Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
A string containing a jmespath expression for further filtering. A string containing a jmespath expression for further filtering.
@ -794,12 +758,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
Elements of this dictionary may, themselves, be dictionaries. Elements of this dictionary may, themselves, be dictionaries.
Example:: Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
A string containing a jmespath expression for further filtering. A string containing a jmespath expression for further filtering.
@ -822,12 +781,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
Elements of this dictionary may, themselves, be dictionaries. Elements of this dictionary may, themselves, be dictionaries.
Example:: Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
A string containing a jmespath expression for further filtering. A string containing a jmespath expression for further filtering.
@ -865,12 +819,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
Elements of this dictionary may, themselves, be dictionaries. Elements of this dictionary may, themselves, be dictionaries.
Example:: Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
A string containing a jmespath expression for further filtering. A string containing a jmespath expression for further filtering.
@ -957,12 +906,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
Elements of this dictionary may, themselves, be dictionaries. Elements of this dictionary may, themselves, be dictionaries.
Example:: Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
A string containing a jmespath expression for further filtering. A string containing a jmespath expression for further filtering.
@ -998,12 +942,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
Elements of this dictionary may, themselves, be dictionaries. Elements of this dictionary may, themselves, be dictionaries.
Example:: Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
A string containing a jmespath expression for further filtering. A string containing a jmespath expression for further filtering.
@ -1026,12 +965,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
Elements of this dictionary may, themselves, be dictionaries. Elements of this dictionary may, themselves, be dictionaries.
Example:: Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
A string containing a jmespath expression for further filtering. A string containing a jmespath expression for further filtering.
@ -1061,12 +995,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
Elements of this dictionary may, themselves, be dictionaries. Elements of this dictionary may, themselves, be dictionaries.
Example:: Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
A string containing a jmespath expression for further filtering. A string containing a jmespath expression for further filtering.
@ -2176,7 +2105,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
[ [
{ {
"subnet_id": "8ca37218-28ff-41cb-9b10-039601ea7e6b", "subnet_id": "8ca37218-28ff-41cb-9b10-039601ea7e6b",
"ip_address": "192.168.10.2" "ip_address": "192.168.10.2",
} }
] ]
@ -2237,7 +2166,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
[ [
{ {
"subnet_id": "8ca37218-28ff-41cb-9b10-039601ea7e6b", "subnet_id": "8ca37218-28ff-41cb-9b10-039601ea7e6b",
"ip_address": "192.168.10.2" "ip_address": "192.168.10.2",
} }
] ]
@ -2247,12 +2176,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
Example:: Example::
[ [{"destination": "179.24.1.0/24", "nexthop": "172.24.3.99"}]
{
"destination": "179.24.1.0/24",
"nexthop": "172.24.3.99"
}
]
:returns: The updated network ``Router`` object. :returns: The updated network ``Router`` object.
:raises: :class:`~openstack.exceptions.SDKException` on operation :raises: :class:`~openstack.exceptions.SDKException` on operation
@ -2346,12 +2270,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
:param allocation_pools: A list of dictionaries of the start and end :param allocation_pools: A list of dictionaries of the start and end
addresses for the allocation pools. For example:: addresses for the allocation pools. For example::
[ [{"start": "192.168.199.2", "end": "192.168.199.254"}]
{
"start": "192.168.199.2",
"end": "192.168.199.254"
}
]
:param string gateway_ip: The gateway IP address. When you specify both :param string gateway_ip: The gateway IP address. When you specify both
allocation_pools and gateway_ip, you must ensure that the gateway allocation_pools and gateway_ip, you must ensure that the gateway
@ -2362,20 +2281,14 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
:param dns_nameservers: A list of DNS name servers for the subnet. For :param dns_nameservers: A list of DNS name servers for the subnet. For
example:: example::
[ "8.8.8.7", "8.8.8.8" ] ["8.8.8.7", "8.8.8.8"]
:param host_routes: A list of host route dictionaries for the subnet. :param host_routes: A list of host route dictionaries for the subnet.
For example:: For example::
[ [
{ {"destination": "0.0.0.0/0", "nexthop": "123.456.78.9"},
"destination": "0.0.0.0/0", {"destination": "192.168.0.0/24", "nexthop": "192.168.0.1"},
"nexthop": "123.456.78.9"
},
{
"destination": "192.168.0.0/24",
"nexthop": "192.168.0.1"
}
] ]
:param string ipv6_ra_mode: IPv6 Router Advertisement mode. Valid :param string ipv6_ra_mode: IPv6 Router Advertisement mode. Valid
@ -2536,30 +2449,19 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
:param allocation_pools: A list of dictionaries of the start and end :param allocation_pools: A list of dictionaries of the start and end
addresses for the allocation pools. For example:: addresses for the allocation pools. For example::
[ [{"start": "192.168.199.2", "end": "192.168.199.254"}]
{
"start": "192.168.199.2",
"end": "192.168.199.254"
}
]
:param dns_nameservers: A list of DNS name servers for the subnet. For :param dns_nameservers: A list of DNS name servers for the subnet. For
example:: example::
[ "8.8.8.7", "8.8.8.8" ] ["8.8.8.7", "8.8.8.8"]
:param host_routes: A list of host route dictionaries for the subnet. :param host_routes: A list of host route dictionaries for the subnet.
For example:: For example::
[ [
{ {"destination": "0.0.0.0/0", "nexthop": "123.456.78.9"},
"destination": "0.0.0.0/0", {"destination": "192.168.0.0/24", "nexthop": "192.168.0.1"},
"nexthop": "123.456.78.9"
},
{
"destination": "192.168.0.0/24",
"nexthop": "192.168.0.1"
}
] ]
:returns: The updated network ``Subnet`` object. :returns: The updated network ``Subnet`` object.
@ -2636,8 +2538,9 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
[ [
{ {
"ip_address": "10.29.29.13", "ip_address": "10.29.29.13",
"subnet_id": "a78484c4-c380-4b47-85aa-21c51a2d8cbd" "subnet_id": "a78484c4-c380-4b47-85aa-21c51a2d8cbd",
}, ... },
...,
] ]
:param subnet_id: If you specify only a subnet ID, OpenStack Networking :param subnet_id: If you specify only a subnet ID, OpenStack Networking
@ -2651,22 +2554,12 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
:param allowed_address_pairs: Allowed address pairs list (Optional) :param allowed_address_pairs: Allowed address pairs list (Optional)
For example:: For example::
[ [{"ip_address": "23.23.23.1", "mac_address": "fa:16:3e:c4:cd:3f"}, ...]
{
"ip_address": "23.23.23.1",
"mac_address": "fa:16:3e:c4:cd:3f"
}, ...
]
:param extra_dhcp_opts: Extra DHCP options. (Optional). :param extra_dhcp_opts: Extra DHCP options. (Optional).
For example:: For example::
[ [{"opt_name": "opt name1", "opt_value": "value1"}, ...]
{
"opt_name": "opt name1",
"opt_value": "value1"
}, ...
]
:param device_owner: The ID of the entity that uses this port. :param device_owner: The ID of the entity that uses this port.
For example, a DHCP agent. (Optional) For example, a DHCP agent. (Optional)
@ -2731,30 +2624,21 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
[ [
{ {
"ip_address": "10.29.29.13", "ip_address": "10.29.29.13",
"subnet_id": "a78484c4-c380-4b47-85aa-21c51a2d8cbd" "subnet_id": "a78484c4-c380-4b47-85aa-21c51a2d8cbd",
}, ... },
...,
] ]
:param security_groups: List of security group UUIDs. (Optional) :param security_groups: List of security group UUIDs. (Optional)
:param allowed_address_pairs: Allowed address pairs list (Optional) :param allowed_address_pairs: Allowed address pairs list (Optional)
For example:: For example::
[ [{"ip_address": "23.23.23.1", "mac_address": "fa:16:3e:c4:cd:3f"}, ...]
{
"ip_address": "23.23.23.1",
"mac_address": "fa:16:3e:c4:cd:3f"
}, ...
]
:param extra_dhcp_opts: Extra DHCP options. (Optional). :param extra_dhcp_opts: Extra DHCP options. (Optional).
For example:: For example::
[ [{"opt_name": "opt name1", "opt_value": "value1"}, ...]
{
"opt_name": "opt name1",
"opt_value": "value1"
}, ...
]
:param device_owner: The ID of the entity that uses this port. :param device_owner: The ID of the entity that uses this port.
For example, a DHCP agent. (Optional) For example, a DHCP agent. (Optional)

View File

@ -458,12 +458,7 @@ class NetworkCommonCloudMixin(openstackcloud._OpenStackCloudMixin):
A dictionary of meta data to use for further filtering. Elements A dictionary of meta data to use for further filtering. Elements
of this dictionary may, themselves, be dictionaries. Example:: of this dictionary may, themselves, be dictionaries. Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
A string containing a jmespath expression for further filtering. A string containing a jmespath expression for further filtering.
@ -1177,8 +1172,7 @@ class NetworkCommonCloudMixin(openstackcloud._OpenStackCloudMixin):
self.network.update_ip(floating_ip_id, port_id=None) self.network.update_ip(floating_ip_id, port_id=None)
except exceptions.SDKException: except exceptions.SDKException:
raise exceptions.SDKException( raise exceptions.SDKException(
"Error detaching IP {ip} from " "Error detaching IP {ip} from server {server_id}".format(
"server {server_id}".format(
ip=floating_ip_id, server_id=server_id ip=floating_ip_id, server_id=server_id
) )
) )
@ -1647,8 +1641,9 @@ class NetworkCommonCloudMixin(openstackcloud._OpenStackCloudMixin):
"floating_ip_address": "198.51.100.10", "floating_ip_address": "198.51.100.10",
"network": "this-is-a-net-or-pool-id", "network": "this-is-a-net-or-pool-id",
"attached": True, "attached": True,
"status": "ACTIVE" "status": "ACTIVE",
}, ... },
...,
] ]
""" """
@ -1769,12 +1764,7 @@ class NetworkCommonCloudMixin(openstackcloud._OpenStackCloudMixin):
A dictionary of meta data to use for further filtering. Elements A dictionary of meta data to use for further filtering. Elements
of this dictionary may, themselves, be dictionaries. Example:: of this dictionary may, themselves, be dictionaries. Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR
A string containing a jmespath expression for further filtering. A string containing a jmespath expression for further filtering.

View File

@ -26,7 +26,6 @@ OBJECT_CONTAINER_ACLS = {
class ObjectStoreCloudMixin(openstackcloud._OpenStackCloudMixin): class ObjectStoreCloudMixin(openstackcloud._OpenStackCloudMixin):
# TODO(stephenfin): Remove 'full_listing' as it's a noop # TODO(stephenfin): Remove 'full_listing' as it's a noop
def list_containers(self, full_listing=True, prefix=None): def list_containers(self, full_listing=True, prefix=None):
"""List containers. """List containers.

View File

@ -17,7 +17,6 @@ from openstack.orchestration.util import event_utils
class OrchestrationCloudMixin(openstackcloud._OpenStackCloudMixin): class OrchestrationCloudMixin(openstackcloud._OpenStackCloudMixin):
def get_template_contents( def get_template_contents(
self, self,
template_file=None, template_file=None,
@ -44,7 +43,7 @@ class OrchestrationCloudMixin(openstackcloud._OpenStackCloudMixin):
wait=False, wait=False,
timeout=3600, timeout=3600,
environment_files=None, environment_files=None,
**parameters **parameters,
): ):
"""Create a stack. """Create a stack.
@ -101,7 +100,7 @@ class OrchestrationCloudMixin(openstackcloud._OpenStackCloudMixin):
wait=False, wait=False,
timeout=3600, timeout=3600,
environment_files=None, environment_files=None,
**parameters **parameters,
): ):
"""Update a stack. """Update a stack.

View File

@ -14,7 +14,6 @@ from openstack.cloud import openstackcloud
class SharedFileSystemCloudMixin(openstackcloud._OpenStackCloudMixin): class SharedFileSystemCloudMixin(openstackcloud._OpenStackCloudMixin):
def list_share_availability_zones(self): def list_share_availability_zones(self):
"""List all availability zones for the Shared File Systems service. """List all availability zones for the Shared File Systems service.

View File

@ -47,12 +47,7 @@ def _filter_list(data, name_or_id, filters):
:param filters: A dictionary of meta data to use for further filtering. :param filters: A dictionary of meta data to use for further filtering.
Elements of this dictionary may, themselves, be dictionaries. Example:: Elements of this dictionary may, themselves, be dictionaries. Example::
{ {'last_name': 'Smith', 'other': {'gender': 'Female'}}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR OR

View File

@ -33,7 +33,7 @@ class OpenStackCloudCreateException(OpenStackCloudException):
resource=resource, resource_id=resource_id resource=resource, resource_id=resource_id
), ),
extra_data=extra_data, extra_data=extra_data,
**kwargs **kwargs,
) )
self.resource_id = resource_id self.resource_id = resource_id

View File

@ -302,6 +302,7 @@ class _OpenStackCloudMixin(_services_mixin.ServicesMixin):
.. code-block:: python .. code-block:: python
from oslo_context import context from oslo_context import context
cloud = openstack.connect(cloud='example') cloud = openstack.connect(cloud='example')
# Work normally # Work normally
servers = cloud.list_servers() servers = cloud.list_servers()
@ -314,6 +315,7 @@ class _OpenStackCloudMixin(_services_mixin.ServicesMixin):
.. code-block:: python .. code-block:: python
from oslo_context import context from oslo_context import context
c = openstack.connect(cloud='example') c = openstack.connect(cloud='example')
# Work normally # Work normally
servers = c.list_servers() servers = c.list_servers()

View File

@ -55,14 +55,14 @@ class QuotaSet(resource.Resource):
requires_id=False, requires_id=False,
base_path=None, base_path=None,
error_message=None, error_message=None,
**params **params,
): ):
return super().fetch( return super().fetch(
session, session,
requires_id=False, requires_id=False,
base_path=base_path, base_path=base_path,
error_message=error_message, error_message=error_message,
**params **params,
) )
def _translate_response(self, response, has_body=None, error_message=None): def _translate_response(self, response, has_body=None, error_message=None):

View File

@ -124,7 +124,7 @@ class Limits(resource.Resource):
error_message=None, error_message=None,
base_path=None, base_path=None,
skip_cache=False, skip_cache=False,
**params **params,
): ):
"""Get the Limits resource. """Get the Limits resource.
@ -142,5 +142,5 @@ class Limits(resource.Resource):
error_message=error_message, error_message=error_message,
base_path=base_path, base_path=base_path,
skip_cache=skip_cache, skip_cache=skip_cache,
**params **params,
) )

View File

@ -39,7 +39,7 @@ class ServerIP(resource.Resource):
server_id=None, server_id=None,
network_label=None, network_label=None,
base_path=None, base_path=None,
**params **params,
): ):
if base_path is None: if base_path is None:
base_path = cls.base_path base_path = cls.base_path

View File

@ -24,7 +24,7 @@ def get_cloud_region(
app_version=None, app_version=None,
load_yaml_config=True, load_yaml_config=True,
load_envvars=True, load_envvars=True,
**kwargs **kwargs,
): ):
config = OpenStackConfig( config = OpenStackConfig(
load_yaml_config=load_yaml_config, load_yaml_config=load_yaml_config,

View File

@ -218,8 +218,9 @@ def from_conf(conf, session=None, service_types=None, **kwargs):
) )
) )
_logger.warning( _logger.warning(
"Disabling service '{service_type}': " "Disabling service '{service_type}': {reason}".format(
"{reason}".format(service_type=st, reason=reason) service_type=st, reason=reason
)
) )
_disable_service(config_dict, st, reason=reason) _disable_service(config_dict, st, reason=reason)
continue continue

View File

@ -87,7 +87,7 @@ settings from files or the environment.
'username': 'amazing-user', 'username': 'amazing-user',
'password': 'super-secret-password', 'password': 'super-secret-password',
'project_id': '33aa1afc-03fe-43b8-8201-4e0d3b4b8ab5', 'project_id': '33aa1afc-03fe-43b8-8201-4e0d3b4b8ab5',
'user_domain_id': '054abd68-9ad9-418b-96d3-3437bb376703' 'user_domain_id': '054abd68-9ad9-418b-96d3-3437bb376703',
}, },
compute_api_version='2', compute_api_version='2',
identity_interface='internal', identity_interface='internal',

View File

@ -35,7 +35,7 @@ class Project(resource.Resource, tag.TagMixin):
'name', 'name',
'parent_id', 'parent_id',
is_enabled='enabled', is_enabled='enabled',
**tag.TagMixin._tag_query_parameters **tag.TagMixin._tag_query_parameters,
) )
# Properties # Properties

View File

@ -349,9 +349,9 @@ class Image(resource.Resource, tag.TagMixin, _download.DownloadMixin):
if remote_region and remote_image_id: if remote_region and remote_image_id:
if remote_service_interface: if remote_service_interface:
data['method'][ data['method']['glance_service_interface'] = (
'glance_service_interface' remote_service_interface
] = remote_service_interface )
data['method']['glance_region'] = remote_region data['method']['glance_region'] = remote_region
data['method']['glance_image_id'] = remote_image_id data['method']['glance_image_id'] = remote_image_id

View File

@ -1188,7 +1188,7 @@ class Proxy(proxy.Proxy):
return self._update( return self._update(
_availability_zone_profile.AvailabilityZoneProfile, _availability_zone_profile.AvailabilityZoneProfile,
availability_zone_profile, availability_zone_profile,
**attrs **attrs,
) )
def create_availability_zone(self, **attrs): def create_availability_zone(self, **attrs):

View File

@ -42,7 +42,7 @@ class HealthMonitor(resource.Resource, tag.TagMixin):
'type', 'type',
'url_path', 'url_path',
is_admin_state_up='admin_state_up', is_admin_state_up='admin_state_up',
**tag.TagMixin._tag_query_parameters **tag.TagMixin._tag_query_parameters,
) )
#: Properties #: Properties

View File

@ -38,7 +38,7 @@ class L7Policy(resource.Resource, tag.TagMixin):
'redirect_prefix', 'redirect_prefix',
'project_id', 'project_id',
is_admin_state_up='admin_state_up', is_admin_state_up='admin_state_up',
**tag.TagMixin._tag_query_parameters **tag.TagMixin._tag_query_parameters,
) )
#: Properties #: Properties

View File

@ -38,7 +38,7 @@ class L7Rule(resource.Resource, tag.TagMixin):
'operating_status', 'operating_status',
is_admin_state_up='admin_state_up', is_admin_state_up='admin_state_up',
l7_policy_id='l7policy_id', l7_policy_id='l7policy_id',
**tag.TagMixin._tag_query_parameters **tag.TagMixin._tag_query_parameters,
) )
#: Properties #: Properties

View File

@ -53,7 +53,7 @@ class Listener(resource.Resource, tag.TagMixin):
is_hsts_include_subdomains='hsts_include_subdomains', is_hsts_include_subdomains='hsts_include_subdomains',
is_hsts_preload='hsts_preload', is_hsts_preload='hsts_preload',
is_admin_state_up='admin_state_up', is_admin_state_up='admin_state_up',
**tag.TagMixin._tag_query_parameters **tag.TagMixin._tag_query_parameters,
) )
# Properties # Properties

View File

@ -40,7 +40,7 @@ class LoadBalancer(resource.Resource, tag.TagMixin):
'operating_status', 'operating_status',
'availability_zone', 'availability_zone',
is_admin_state_up='admin_state_up', is_admin_state_up='admin_state_up',
**tag.TagMixin._tag_query_parameters **tag.TagMixin._tag_query_parameters,
) )
# Properties # Properties

View File

@ -40,7 +40,7 @@ class Member(resource.Resource, tag.TagMixin):
'monitor_port', 'monitor_port',
'backup', 'backup',
is_admin_state_up='admin_state_up', is_admin_state_up='admin_state_up',
**tag.TagMixin._tag_query_parameters **tag.TagMixin._tag_query_parameters,
) )
# Properties # Properties

View File

@ -45,7 +45,7 @@ class Pool(resource.Resource, tag.TagMixin):
'ca_tls_container_ref', 'ca_tls_container_ref',
'crl_container_ref', 'crl_container_ref',
is_admin_state_up='admin_state_up', is_admin_state_up='admin_state_up',
**tag.TagMixin._tag_query_parameters **tag.TagMixin._tag_query_parameters,
) )
#: Properties #: Properties

View File

@ -26,7 +26,7 @@ class NetworkResource(resource.Resource):
base_path=None, base_path=None,
params=None, params=None,
if_revision=None, if_revision=None,
**kwargs **kwargs,
): ):
req = super()._prepare_request( req = super()._prepare_request(
requires_id=requires_id, requires_id=requires_id,

View File

@ -43,7 +43,7 @@ class FloatingIP(_base.NetworkResource, tag.TagMixin):
'sort_key', 'sort_key',
'sort_dir', 'sort_dir',
tenant_id='project_id', tenant_id='project_id',
**tag.TagMixin._tag_query_parameters **tag.TagMixin._tag_query_parameters,
) )
# Properties # Properties

View File

@ -43,7 +43,7 @@ class Network(_base.NetworkResource, tag.TagMixin):
provider_network_type='provider:network_type', provider_network_type='provider:network_type',
provider_physical_network='provider:physical_network', provider_physical_network='provider:physical_network',
provider_segmentation_id='provider:segmentation_id', provider_segmentation_id='provider:segmentation_id',
**tag.TagMixin._tag_query_parameters **tag.TagMixin._tag_query_parameters,
) )
# Properties # Properties

View File

@ -53,7 +53,7 @@ class Port(_base.NetworkResource, tag.TagMixin):
is_admin_state_up='admin_state_up', is_admin_state_up='admin_state_up',
is_port_security_enabled='port_security_enabled', is_port_security_enabled='port_security_enabled',
security_group_ids='security_groups', security_group_ids='security_groups',
**tag.TagMixin._tag_query_parameters **tag.TagMixin._tag_query_parameters,
) )
# Properties # Properties

View File

@ -36,7 +36,7 @@ class QoSPolicy(resource.Resource, tag.TagMixin):
'sort_key', 'sort_key',
'sort_dir', 'sort_dir',
is_shared='shared', is_shared='shared',
**tag.TagMixin._tag_query_parameters **tag.TagMixin._tag_query_parameters,
) )
# Properties # Properties

View File

@ -40,7 +40,7 @@ class Router(_base.NetworkResource, tag.TagMixin):
is_admin_state_up='admin_state_up', is_admin_state_up='admin_state_up',
is_distributed='distributed', is_distributed='distributed',
is_ha='ha', is_ha='ha',
**tag.TagMixin._tag_query_parameters **tag.TagMixin._tag_query_parameters,
) )
# Properties # Properties

View File

@ -37,7 +37,7 @@ class SecurityGroup(_base.NetworkResource, tag.TagMixin):
'revision_number', 'revision_number',
'sort_dir', 'sort_dir',
'sort_key', 'sort_key',
**tag.TagMixin._tag_query_parameters **tag.TagMixin._tag_query_parameters,
) )
# Properties # Properties

View File

@ -43,7 +43,7 @@ class SecurityGroupRule(_base.NetworkResource, tag.TagMixin):
'sort_dir', 'sort_dir',
'sort_key', 'sort_key',
ether_type='ethertype', ether_type='ethertype',
**tag.TagMixin._tag_query_parameters **tag.TagMixin._tag_query_parameters,
) )
# Properties # Properties

View File

@ -44,7 +44,7 @@ class Subnet(_base.NetworkResource, tag.TagMixin):
is_dhcp_enabled='enable_dhcp', is_dhcp_enabled='enable_dhcp',
subnet_pool_id='subnetpool_id', subnet_pool_id='subnetpool_id',
use_default_subnet_pool='use_default_subnetpool', use_default_subnet_pool='use_default_subnetpool',
**tag.TagMixin._tag_query_parameters **tag.TagMixin._tag_query_parameters,
) )
# Properties # Properties

View File

@ -37,7 +37,7 @@ class SubnetPool(resource.Resource, tag.TagMixin):
'sort_key', 'sort_key',
'sort_dir', 'sort_dir',
is_shared='shared', is_shared='shared',
**tag.TagMixin._tag_query_parameters **tag.TagMixin._tag_query_parameters,
) )
# Properties # Properties

View File

@ -37,7 +37,7 @@ class Trunk(resource.Resource, tag.TagMixin):
'sub_ports', 'sub_ports',
'project_id', 'project_id',
is_admin_state_up='admin_state_up', is_admin_state_up='admin_state_up',
**tag.TagMixin._tag_query_parameters **tag.TagMixin._tag_query_parameters,
) )
# Properties # Properties

View File

@ -635,12 +635,12 @@ class Proxy(proxy.Proxy):
stack_id=obj.id, stack_id=obj.id,
resource_name=resource_name, resource_name=resource_name,
base_path=base_path, base_path=base_path,
**attr **attr,
) )
return self._list( return self._list(
_stack_event.StackEvent, _stack_event.StackEvent,
stack_name=obj.name, stack_name=obj.name,
stack_id=obj.id, stack_id=obj.id,
**attr **attr,
) )

View File

@ -79,7 +79,7 @@ class ShareAccessRule(resource.Resource):
session, session,
resource_request_key='allow_access', resource_request_key='allow_access',
resource_response_key='access', resource_response_key='access',
**kwargs **kwargs,
) )
def delete( def delete(

View File

@ -18,6 +18,7 @@ test_devstack
Throw errors if we do not actually detect the services we're supposed to. Throw errors if we do not actually detect the services we're supposed to.
""" """
import os import os
from testscenarios import load_tests_apply_scenarios as load_tests # noqa from testscenarios import load_tests_apply_scenarios as load_tests # noqa

View File

@ -32,7 +32,6 @@ from openstack.tests.functional import base
class TestFloatingIPPool(base.BaseFunctionalTest): class TestFloatingIPPool(base.BaseFunctionalTest):
def test_list_floating_ip_pools(self): def test_list_floating_ip_pools(self):
pools = self.user_cloud.list_floating_ip_pools() pools = self.user_cloud.list_floating_ip_pools()
if not pools: if not pools:

View File

@ -16,6 +16,7 @@ test_keypairs
Functional tests for keypairs methods Functional tests for keypairs methods
""" """
from openstack.tests import fakes from openstack.tests import fakes
from openstack.tests.functional import base from openstack.tests.functional import base

View File

@ -16,6 +16,7 @@ test_limits
Functional tests for limits method Functional tests for limits method
""" """
from openstack.compute.v2 import limits as _limits from openstack.compute.v2 import limits as _limits
from openstack.tests.functional import base from openstack.tests.functional import base

View File

@ -18,6 +18,7 @@ test_project
Functional tests for project resource. Functional tests for project resource.
""" """
import pprint import pprint
from openstack import exceptions from openstack import exceptions

View File

@ -16,6 +16,7 @@ test_recordset
Functional tests for recordset methods. Functional tests for recordset methods.
""" """
import random import random
import string import string

View File

@ -16,6 +16,7 @@ test_volume
Functional tests for block storage methods. Functional tests for block storage methods.
""" """
import testtools import testtools
from openstack import exceptions from openstack import exceptions

View File

@ -109,7 +109,7 @@ class TestMetadefProperty(base.BaseImageTest):
metadef_property = self.conn.image.update_metadef_property( metadef_property = self.conn.image.update_metadef_property(
self.metadef_property, self.metadef_property,
self.metadef_namespace.namespace, self.metadef_namespace.namespace,
**self.attrs **self.attrs,
) )
self.assertIsNotNone(metadef_property) self.assertIsNotNone(metadef_property)
self.assertIsInstance( self.assertIsInstance(

View File

@ -90,7 +90,7 @@ class TestLoadBalancer(base.BaseFunctionalTest):
'listener': 100, 'listener': 100,
'health_monitor': 100, 'health_monitor': 100,
'member': 100, 'member': 100,
} },
) )
assert isinstance(test_quota, quota.Quota) assert isinstance(test_quota, quota.Quota)
self.assertEqual(self.PROJECT_ID, test_quota.id) self.assertEqual(self.PROJECT_ID, test_quota.id)

View File

@ -75,7 +75,7 @@ class TestFloatingIP(base.BaseFunctionalTest):
# Create Router # Create Router
sot = self.user_cloud.network.create_router( sot = self.user_cloud.network.create_router(
name=self.ROT_NAME, name=self.ROT_NAME,
**{"external_gateway_info": {"network_id": self.EXT_NET_ID}} **{"external_gateway_info": {"network_id": self.EXT_NET_ID}},
) )
assert isinstance(sot, router.Router) assert isinstance(sot, router.Router)
self.assertEqual(self.ROT_NAME, sot.name) self.assertEqual(self.ROT_NAME, sot.name)

View File

@ -86,7 +86,7 @@ class TestPortForwarding(base.BaseFunctionalTest):
# Create Router # Create Router
sot = self.user_cloud.network.create_router( sot = self.user_cloud.network.create_router(
name=self.ROT_NAME, name=self.ROT_NAME,
**{"external_gateway_info": {"network_id": self.EXT_NET_ID}} **{"external_gateway_info": {"network_id": self.EXT_NET_ID}},
) )
assert isinstance(sot, router.Router) assert isinstance(sot, router.Router)
self.assertEqual(self.ROT_NAME, sot.name) self.assertEqual(self.ROT_NAME, sot.name)

View File

@ -29,7 +29,7 @@ class QuotaClassSetTest(base.BaseSharedFileSystemTest):
project_id, project_id,
**{ **{
"backups": initial_backups_value + 1, "backups": initial_backups_value + 1,
} },
) )
) )
self.assertEqual( self.assertEqual(

View File

@ -98,7 +98,7 @@ class TestType(base.TestCase):
exceptions.BadRequestException, exceptions.BadRequestException,
sot.set_extra_specs, sot.set_extra_specs,
sess, sess,
**set_specs **set_specs,
) )
def test_delete_extra_specs(self): def test_delete_extra_specs(self):

View File

@ -1744,7 +1744,7 @@ class TestBaremetalNode(base.IronicTestCase):
exceptions.SDKException, exceptions.SDKException,
self.cloud.register_machine, self.cloud.register_machine,
nics, nics,
**node_to_post **node_to_post,
) )
self.assert_calls() self.assert_calls()
@ -1811,7 +1811,7 @@ class TestBaremetalNode(base.IronicTestCase):
nics, nics,
timeout=0.001, timeout=0.001,
lock_timeout=0.001, lock_timeout=0.001,
**node_to_post **node_to_post,
) )
self.assert_calls() self.assert_calls()
@ -1901,7 +1901,7 @@ class TestBaremetalNode(base.IronicTestCase):
nics, nics,
wait=True, wait=True,
timeout=0.001, timeout=0.001,
**node_to_post **node_to_post,
) )
self.assert_calls() self.assert_calls()
@ -1949,7 +1949,7 @@ class TestBaremetalNode(base.IronicTestCase):
'no ports for you', 'no ports for you',
self.cloud.register_machine, self.cloud.register_machine,
nics, nics,
**node_to_post **node_to_post,
) )
self.assert_calls() self.assert_calls()
@ -2015,7 +2015,7 @@ class TestBaremetalNode(base.IronicTestCase):
'no ports for you', 'no ports for you',
self.cloud.register_machine, self.cloud.register_machine,
nics, nics,
**node_to_post **node_to_post,
) )
self.assert_calls() self.assert_calls()

View File

@ -16,6 +16,7 @@ test_delete_server
Tests for the `delete_server` command. Tests for the `delete_server` command.
""" """
import uuid import uuid
from openstack import exceptions from openstack import exceptions

View File

@ -94,7 +94,7 @@ class TestFirewallRule(FirewallTestCase):
self.assertRaises( self.assertRaises(
exceptions.BadRequestException, exceptions.BadRequestException,
self.cloud.create_firewall_rule, self.cloud.create_firewall_rule,
**bad_rule **bad_rule,
) )
self.assert_calls() self.assert_calls()
@ -146,7 +146,7 @@ class TestFirewallRule(FirewallTestCase):
uri=self._make_mock_url( uri=self._make_mock_url(
'firewall_rules', 'firewall_rules',
name=self.firewall_rule_name, name=self.firewall_rule_name,
**filters **filters,
), ),
json={'firewall_rules': [self.mock_firewall_rule]}, json={'firewall_rules': [self.mock_firewall_rule]},
), ),
@ -446,7 +446,7 @@ class TestFirewallPolicy(FirewallTestCase):
self.assertRaises( self.assertRaises(
exceptions.NotFoundException, exceptions.NotFoundException,
self.cloud.create_firewall_policy, self.cloud.create_firewall_policy,
**posted_policy **posted_policy,
) )
self.cloud.network.create_firewall_policy.assert_not_called() self.cloud.network.create_firewall_policy.assert_not_called()
self.assert_calls() self.assert_calls()

View File

@ -1030,7 +1030,7 @@ class TestConfigArgparse(base.TestCase):
cc = c.get_one( cc = c.get_one(
region_name='region2', region_name='region2',
argparse=None, argparse=None,
**base.USER_CONF['clouds']['_test_cloud_regions'] **base.USER_CONF['clouds']['_test_cloud_regions'],
) )
# Not using assert_cloud_details because of cache settings which # Not using assert_cloud_details because of cache settings which
# are not present without the file # are not present without the file

View File

@ -30,7 +30,7 @@ class TestFromConf(base.TestCase):
oslocfg, oslocfg,
session=self.cloud.session, session=self.cloud.session,
name='from_conf.example.com', name='from_conf.example.com',
**from_conf_kwargs **from_conf_kwargs,
) )
self.assertEqual('from_conf.example.com', config.name) self.assertEqual('from_conf.example.com', config.name)

View File

@ -657,7 +657,7 @@ class TestTempURLUnicodePathAndKey(TestTempURL):
url = '/v1/\u00e4/c/\u00f3' url = '/v1/\u00e4/c/\u00f3'
key = 'k\u00e9y' key = 'k\u00e9y'
expected_url = ( expected_url = (
'%s?temp_url_sig=temp_url_signature' '&temp_url_expires=1400003600' '%s?temp_url_sig=temp_url_signature&temp_url_expires=1400003600'
) % url ) % url
expected_body = '\n'.join( expected_body = '\n'.join(
[ [
@ -672,7 +672,7 @@ class TestTempURLUnicodePathBytesKey(TestTempURL):
url = '/v1/\u00e4/c/\u00f3' url = '/v1/\u00e4/c/\u00f3'
key = 'k\u00e9y'.encode() key = 'k\u00e9y'.encode()
expected_url = ( expected_url = (
'%s?temp_url_sig=temp_url_signature' '&temp_url_expires=1400003600' '%s?temp_url_sig=temp_url_signature&temp_url_expires=1400003600'
) % url ) % url
expected_body = '\n'.join( expected_body = '\n'.join(
[ [

View File

@ -87,9 +87,7 @@ VENDOR_CONFIG = """
"vendor_hook": "openstack.tests.unit.test_connection:vendor_hook" "vendor_hook": "openstack.tests.unit.test_connection:vendor_hook"
}} }}
}} }}
""".format( """.format(auth_url=CONFIG_AUTH_URL)
auth_url=CONFIG_AUTH_URL
)
PUBLIC_CLOUDS_YAML = """ PUBLIC_CLOUDS_YAML = """
public-clouds: public-clouds:
@ -97,9 +95,7 @@ public-clouds:
auth: auth:
auth_url: {auth_url} auth_url: {auth_url}
vendor_hook: openstack.tests.unit.test_connection:vendor_hook vendor_hook: openstack.tests.unit.test_connection:vendor_hook
""".format( """.format(auth_url=CONFIG_AUTH_URL)
auth_url=CONFIG_AUTH_URL
)
class _TestConnectionBase(base.TestCase): class _TestConnectionBase(base.TestCase):

6
pyproject.toml Normal file
View File

@ -0,0 +1,6 @@
[tool.ruff]
line-length = 79
[tool.ruff.format]
quote-style = "preserve"
docstring-code-format = true