Normalise query strings passed to 'find_*' methods
There were a number of methods that weren't using these, so stop gathering and silently dropping them. We also take the opportunity to standardise on our naming, opting for 'query'. Change-Id: Ic7bddd44f6c3363c75cad21a724a4ffff04d8557 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
parent
17fde652ad
commit
0018c5df18
@ -199,7 +199,7 @@ class Proxy(_base_proxy.BaseBlockStorageProxy):
|
||||
"""
|
||||
return self._get(_volume.Volume, volume)
|
||||
|
||||
def find_volume(self, name_or_id, ignore_missing=True, **attrs):
|
||||
def find_volume(self, name_or_id, ignore_missing=True):
|
||||
"""Find a single volume
|
||||
|
||||
:param snapshot: The name or ID a volume
|
||||
|
@ -62,7 +62,7 @@ class Proxy(_base_proxy.BaseBlockStorageProxy):
|
||||
"""
|
||||
return self._get(_snapshot.Snapshot, snapshot)
|
||||
|
||||
def find_snapshot(self, name_or_id, ignore_missing=True, **attrs):
|
||||
def find_snapshot(self, name_or_id, ignore_missing=True):
|
||||
"""Find a single snapshot
|
||||
|
||||
:param snapshot: The name or ID a snapshot
|
||||
@ -231,7 +231,7 @@ class Proxy(_base_proxy.BaseBlockStorageProxy):
|
||||
"""
|
||||
return self._get(_type.Type, type)
|
||||
|
||||
def find_type(self, name_or_id, ignore_missing=True, **attrs):
|
||||
def find_type(self, name_or_id, ignore_missing=True):
|
||||
"""Find a single volume type
|
||||
|
||||
:param snapshot: The name or ID a volume type
|
||||
@ -469,7 +469,7 @@ class Proxy(_base_proxy.BaseBlockStorageProxy):
|
||||
"""
|
||||
return self._get(_volume.Volume, volume)
|
||||
|
||||
def find_volume(self, name_or_id, ignore_missing=True, **attrs):
|
||||
def find_volume(self, name_or_id, ignore_missing=True):
|
||||
"""Find a single volume
|
||||
|
||||
:param snapshot: The name or ID a volume
|
||||
@ -910,7 +910,7 @@ class Proxy(_base_proxy.BaseBlockStorageProxy):
|
||||
"""
|
||||
return self._get(_backup.Backup, backup)
|
||||
|
||||
def find_backup(self, name_or_id, ignore_missing=True, **attrs):
|
||||
def find_backup(self, name_or_id, ignore_missing=True):
|
||||
"""Find a single backup
|
||||
|
||||
:param snapshot: The name or ID a backup
|
||||
@ -1021,7 +1021,7 @@ class Proxy(_base_proxy.BaseBlockStorageProxy):
|
||||
"""
|
||||
return self._get(_group.Group, group_id, **attrs)
|
||||
|
||||
def find_group(self, name_or_id, ignore_missing=True, **attrs):
|
||||
def find_group(self, name_or_id, ignore_missing=True):
|
||||
"""Find a single group
|
||||
|
||||
:param name_or_id: The name or ID of a group.
|
||||
|
@ -1551,18 +1551,27 @@ class Proxy(proxy.Proxy):
|
||||
"""
|
||||
return self._list(_service.Service, **query)
|
||||
|
||||
def find_service(self, name_or_id, ignore_missing=True, **attrs):
|
||||
def find_service(self, name_or_id, ignore_missing=True, **query):
|
||||
"""Find a service from name or id to get the corresponding info
|
||||
|
||||
:param name_or_id: The name or id of a service
|
||||
:param dict attrs: Additional attributes like 'host'
|
||||
:param bool ignore_missing: When set to ``False``
|
||||
:class:`~openstack.exceptions.ResourceNotFound` will be
|
||||
raised when the resource does not exist.
|
||||
When set to ``True``, None will be returned when
|
||||
attempting to find a nonexistent resource.
|
||||
:param dict query: Additional attributes like 'host'
|
||||
|
||||
:returns:
|
||||
One: class:`~openstack.compute.v2.hypervisor.Hypervisor` object
|
||||
or None
|
||||
"""
|
||||
return self._find(_service.Service, name_or_id,
|
||||
ignore_missing=ignore_missing, **attrs)
|
||||
return self._find(
|
||||
_service.Service,
|
||||
name_or_id,
|
||||
ignore_missing=ignore_missing,
|
||||
**query,
|
||||
)
|
||||
|
||||
def delete_service(self, service, ignore_missing=True):
|
||||
"""Delete a service
|
||||
@ -1572,9 +1581,8 @@ class Proxy(proxy.Proxy):
|
||||
:class:`~openstack.compute.v2.service.Service` instance.
|
||||
:param bool ignore_missing: When set to ``False``
|
||||
:class:`~openstack.exceptions.ResourceNotFound` will be raised when
|
||||
the volume attachment does not exist. When set to ``True``, no
|
||||
exception will be set when attempting to delete a nonexistent
|
||||
volume attachment.
|
||||
the service does not exist. When set to ``True``, no exception
|
||||
will be set when attempting to delete a nonexistent service.
|
||||
|
||||
:returns: ``None``
|
||||
"""
|
||||
|
@ -97,7 +97,7 @@ class Proxy(proxy.Proxy):
|
||||
"""
|
||||
return self._update(_zone.Zone, zone, **attrs)
|
||||
|
||||
def find_zone(self, name_or_id, ignore_missing=True, **attrs):
|
||||
def find_zone(self, name_or_id, ignore_missing=True):
|
||||
"""Find a single zone
|
||||
|
||||
:param name_or_id: The name or ID of a zone
|
||||
@ -225,7 +225,7 @@ class Proxy(proxy.Proxy):
|
||||
return self._delete(_rs.Recordset, recordset,
|
||||
ignore_missing=ignore_missing)
|
||||
|
||||
def find_recordset(self, zone, name_or_id, ignore_missing=True, **attrs):
|
||||
def find_recordset(self, zone, name_or_id, ignore_missing=True, **query):
|
||||
"""Find a single recordset
|
||||
|
||||
:param zone: The value can be the ID of a zone
|
||||
@ -240,9 +240,13 @@ class Proxy(proxy.Proxy):
|
||||
:returns: :class:`~openstack.dns.v2.recordset.Recordset`
|
||||
"""
|
||||
zone = self._get_resource(_zone.Zone, zone)
|
||||
return self._find(_rs.Recordset, name_or_id,
|
||||
ignore_missing=ignore_missing, zone_id=zone.id,
|
||||
**attrs)
|
||||
return self._find(
|
||||
_rs.Recordset,
|
||||
name_or_id,
|
||||
ignore_missing=ignore_missing,
|
||||
zone_id=zone.id,
|
||||
**query,
|
||||
)
|
||||
|
||||
# ======== Zone Imports ========
|
||||
def zone_imports(self, **query):
|
||||
|
@ -348,7 +348,7 @@ class Proxy(proxy.Proxy):
|
||||
"""
|
||||
self._delete(_group.Group, group, ignore_missing=ignore_missing)
|
||||
|
||||
def find_group(self, name_or_id, ignore_missing=True, **kwargs):
|
||||
def find_group(self, name_or_id, ignore_missing=True, **query):
|
||||
"""Find a single group
|
||||
|
||||
:param name_or_id: The name or ID of a group.
|
||||
@ -359,9 +359,12 @@ class Proxy(proxy.Proxy):
|
||||
attempting to find a nonexistent resource.
|
||||
:returns: One :class:`~openstack.identity.v3.group.Group` or None
|
||||
"""
|
||||
return self._find(_group.Group, name_or_id,
|
||||
ignore_missing=ignore_missing,
|
||||
**kwargs)
|
||||
return self._find(
|
||||
_group.Group,
|
||||
name_or_id,
|
||||
ignore_missing=ignore_missing,
|
||||
**query,
|
||||
)
|
||||
|
||||
def get_group(self, group):
|
||||
"""Get a single group
|
||||
@ -560,7 +563,7 @@ class Proxy(proxy.Proxy):
|
||||
"""
|
||||
self._delete(_project.Project, project, ignore_missing=ignore_missing)
|
||||
|
||||
def find_project(self, name_or_id, ignore_missing=True, **attrs):
|
||||
def find_project(self, name_or_id, ignore_missing=True, **query):
|
||||
"""Find a single project
|
||||
|
||||
:param name_or_id: The name or ID of a project.
|
||||
@ -571,8 +574,12 @@ class Proxy(proxy.Proxy):
|
||||
attempting to find a nonexistent resource.
|
||||
:returns: One :class:`~openstack.identity.v3.project.Project` or None
|
||||
"""
|
||||
return self._find(_project.Project, name_or_id,
|
||||
ignore_missing=ignore_missing, **attrs)
|
||||
return self._find(
|
||||
_project.Project,
|
||||
name_or_id,
|
||||
ignore_missing=ignore_missing,
|
||||
**query,
|
||||
)
|
||||
|
||||
def get_project(self, project):
|
||||
"""Get a single project
|
||||
@ -731,7 +738,7 @@ class Proxy(proxy.Proxy):
|
||||
"""
|
||||
self._delete(_user.User, user, ignore_missing=ignore_missing)
|
||||
|
||||
def find_user(self, name_or_id, ignore_missing=True, **attrs):
|
||||
def find_user(self, name_or_id, ignore_missing=True, **query):
|
||||
"""Find a single user
|
||||
|
||||
:param name_or_id: The name or ID of a user.
|
||||
@ -742,8 +749,12 @@ class Proxy(proxy.Proxy):
|
||||
attempting to find a nonexistent resource.
|
||||
:returns: One :class:`~openstack.identity.v3.user.User` or None
|
||||
"""
|
||||
return self._find(_user.User, name_or_id,
|
||||
ignore_missing=ignore_missing, **attrs)
|
||||
return self._find(
|
||||
_user.User,
|
||||
name_or_id,
|
||||
ignore_missing=ignore_missing,
|
||||
**query,
|
||||
)
|
||||
|
||||
def get_user(self, user):
|
||||
"""Get a single user
|
||||
@ -952,7 +963,7 @@ class Proxy(proxy.Proxy):
|
||||
"""
|
||||
self._delete(_role.Role, role, ignore_missing=ignore_missing)
|
||||
|
||||
def find_role(self, name_or_id, ignore_missing=True, **kwargs):
|
||||
def find_role(self, name_or_id, ignore_missing=True, **query):
|
||||
"""Find a single role
|
||||
|
||||
:param name_or_id: The name or ID of a role.
|
||||
@ -963,9 +974,12 @@ class Proxy(proxy.Proxy):
|
||||
attempting to find a nonexistent role.
|
||||
:returns: One :class:`~openstack.identity.v3.role.Role` or None
|
||||
"""
|
||||
return self._find(_role.Role, name_or_id,
|
||||
ignore_missing=ignore_missing,
|
||||
**kwargs)
|
||||
return self._find(
|
||||
_role.Role,
|
||||
name_or_id,
|
||||
ignore_missing=ignore_missing,
|
||||
**query,
|
||||
)
|
||||
|
||||
def get_role(self, role):
|
||||
"""Get a single role
|
||||
@ -1574,8 +1588,13 @@ class Proxy(proxy.Proxy):
|
||||
name=name,
|
||||
user_id=user.id, **attrs)
|
||||
|
||||
def find_application_credential(self, user, name_or_id,
|
||||
ignore_missing=True, **args):
|
||||
def find_application_credential(
|
||||
self,
|
||||
user,
|
||||
name_or_id,
|
||||
ignore_missing=True,
|
||||
**query,
|
||||
):
|
||||
"""Find a single application credential
|
||||
|
||||
:param user: Either the ID of a user or a
|
||||
@ -1592,9 +1611,13 @@ class Proxy(proxy.Proxy):
|
||||
or None
|
||||
"""
|
||||
user = self._get_resource(_user.User, user)
|
||||
return self._find(_application_credential.ApplicationCredential,
|
||||
user_id=user.id, name_or_id=name_or_id,
|
||||
ignore_missing=ignore_missing, **args)
|
||||
return self._find(
|
||||
_application_credential.ApplicationCredential,
|
||||
user_id=user.id,
|
||||
name_or_id=name_or_id,
|
||||
ignore_missing=ignore_missing,
|
||||
**query,
|
||||
)
|
||||
|
||||
def delete_application_credential(self, user, application_credential,
|
||||
ignore_missing=True):
|
||||
@ -1673,8 +1696,7 @@ class Proxy(proxy.Proxy):
|
||||
self._delete(cls, protocol,
|
||||
ignore_missing=ignore_missing, idp_id=idp_id)
|
||||
|
||||
def find_federation_protocol(self, idp_id, protocol,
|
||||
ignore_missing=True):
|
||||
def find_federation_protocol(self, idp_id, protocol, ignore_missing=True):
|
||||
"""Find a single federation protocol
|
||||
|
||||
:param idp_id: The ID of the identity provider or a
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user