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:
- id: ruff
args: ['--fix']
- repo: https://github.com/psf/black
rev: 24.8.0
hooks:
- id: black
args: ['-S', '-l', '79']
- id: ruff-format
- repo: https://opendev.org/openstack/hacking
rev: 7.0.0
hooks:

View File

@ -61,5 +61,5 @@ def assert_no_deprecated_exceptions(logical_line, filename):
'OpenStackCloudURINotFound',
'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')

View File

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

View File

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

View File

@ -42,7 +42,6 @@ def _normalize_port_list(nics):
class BaremetalCloudMixin(openstackcloud._OpenStackCloudMixin):
def list_nics(self):
"""Return a list of all bare metal ports."""
return list(self.baremetal.ports(details=True))
@ -187,7 +186,7 @@ class BaremetalCloudMixin(openstackcloud._OpenStackCloudMixin):
timeout=3600,
lock_timeout=600,
provision_state='available',
**kwargs
**kwargs,
):
"""Register Baremetal with Ironic
@ -208,10 +207,7 @@ class BaremetalCloudMixin(openstackcloud._OpenStackCloudMixin):
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.
:param wait: Boolean value, defaulting to false, to wait for the node
@ -352,21 +348,16 @@ class BaremetalCloudMixin(openstackcloud._OpenStackCloudMixin):
Example patch construction::
patch=[]
patch.append({
'op': 'remove',
'path': '/instance_info'
})
patch.append({
'op': 'replace',
'path': '/name',
'value': 'newname'
})
patch.append({
'op': 'add',
'path': '/driver_info/username',
'value': 'administrator'
})
patch = []
patch.append({'op': 'remove', 'path': '/instance_info'})
patch.append({'op': 'replace', 'path': '/name', 'value': 'newname'})
patch.append(
{
'op': 'add',
'path': '/driver_info/username',
'value': 'administrator',
}
)
:returns: Current state of the 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):
# TODO(stephenfin): Remove 'cache' in a future major version
def list_volumes(self, cache=True):
"""List all available volumes.
@ -59,12 +58,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin):
further filtering. Elements of this dictionary may, themselves, be
dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
@ -94,12 +88,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin):
further filtering. Elements of this dictionary may, themselves, be
dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
@ -467,12 +456,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin):
further filtering. Elements of this dictionary may, themselves, be
dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
@ -542,12 +526,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin):
further filtering. Elements of this dictionary may, themselves, be
dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
@ -570,7 +549,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin):
{
'name': 'my-volume-snapshot',
'volume_id': 'e126044c-7b4c-43be-a32a-c9cbbc9ddb56',
'all_tenants': 1
'all_tenants': 1,
}
:returns: A list of volume ``Snapshot`` objects.
@ -590,7 +569,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin):
'name': 'my-volume-backup',
'status': 'available',
'volume_id': 'e126044c-7b4c-43be-a32a-c9cbbc9ddb56',
'all_tenants': 1
'all_tenants': 1,
}
:returns: A list of volume ``Backup`` objects.
@ -671,12 +650,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin):
further filtering. Elements of this dictionary may, themselves, be
dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
@ -698,12 +672,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin):
further filtering. Elements of this dictionary may, themselves, be
dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
@ -725,12 +694,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin):
further filtering. Elements of this dictionary may, themselves, be
dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
@ -758,12 +722,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin):
further filtering. Elements of this dictionary may, themselves, be
dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR

View File

@ -16,7 +16,6 @@ from openstack import exceptions
class CoeCloudMixin(openstackcloud._OpenStackCloudMixin):
def list_coe_clusters(self):
"""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
of this dictionary may, themselves, be dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
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
of this dictionary may, themselves, be dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
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):
@property
def _compute_region(self):
# 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.
Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
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.
Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
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
of this dictionary may, themselves, be dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
A string containing a jmespath expression for further filtering.
@ -1640,9 +1624,7 @@ class ComputeCloudMixin(_network_common.NetworkCommonCloudMixin):
{
'availability_zone': 'nova',
'metadata': {
'cpu_allocation_ratio': '1.0'
}
'metadata': {'cpu_allocation_ratio': '1.0'},
}
: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):
def list_zones(self, filters=None):
"""List all available zones.

View File

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

View File

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

View File

@ -17,7 +17,6 @@ from openstack import exceptions
class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
def _neutron_extensions(self):
extensions = set()
for extension in self.network.extensions():
@ -180,12 +179,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
Elements of this dictionary may, themselves, be dictionaries.
Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
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.
Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
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.
Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
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.
Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
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.
Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
: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.
Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
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 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
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 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
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.
Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
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.
Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
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.
Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
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.
Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
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.
Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
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.
Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
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.
Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
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.
Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
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",
"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",
"ip_address": "192.168.10.2"
"ip_address": "192.168.10.2",
}
]
@ -2247,12 +2176,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
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.
: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
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
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
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.
For example::
[
{
"destination": "0.0.0.0/0",
"nexthop": "123.456.78.9"
},
{
"destination": "192.168.0.0/24",
"nexthop": "192.168.0.1"
}
{"destination": "0.0.0.0/0", "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
@ -2536,30 +2449,19 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
:param allocation_pools: A list of dictionaries of the start and end
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
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.
For example::
[
{
"destination": "0.0.0.0/0",
"nexthop": "123.456.78.9"
},
{
"destination": "192.168.0.0/24",
"nexthop": "192.168.0.1"
}
{"destination": "0.0.0.0/0", "nexthop": "123.456.78.9"},
{"destination": "192.168.0.0/24", "nexthop": "192.168.0.1"},
]
:returns: The updated network ``Subnet`` object.
@ -2636,8 +2538,9 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
[
{
"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
@ -2651,22 +2554,12 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
:param allowed_address_pairs: Allowed address pairs list (Optional)
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).
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.
For example, a DHCP agent. (Optional)
@ -2731,30 +2624,21 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
[
{
"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 allowed_address_pairs: Allowed address pairs list (Optional)
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).
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.
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
of this dictionary may, themselves, be dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
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)
except exceptions.SDKException:
raise exceptions.SDKException(
"Error detaching IP {ip} from "
"server {server_id}".format(
"Error detaching IP {ip} from server {server_id}".format(
ip=floating_ip_id, server_id=server_id
)
)
@ -1647,8 +1641,9 @@ class NetworkCommonCloudMixin(openstackcloud._OpenStackCloudMixin):
"floating_ip_address": "198.51.100.10",
"network": "this-is-a-net-or-pool-id",
"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
of this dictionary may, themselves, be dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR
A string containing a jmespath expression for further filtering.

View File

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

View File

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

View File

@ -14,7 +14,6 @@ from openstack.cloud import openstackcloud
class SharedFileSystemCloudMixin(openstackcloud._OpenStackCloudMixin):
def list_share_availability_zones(self):
"""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.
Elements of this dictionary may, themselves, be dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{'last_name': 'Smith', 'other': {'gender': 'Female'}}
OR

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -218,8 +218,9 @@ def from_conf(conf, session=None, service_types=None, **kwargs):
)
)