diff --git a/openstack/baremetal/v1/_proxy.py b/openstack/baremetal/v1/_proxy.py index f0fcd1530..1722f5ac8 100644 --- a/openstack/baremetal/v1/_proxy.py +++ b/openstack/baremetal/v1/_proxy.py @@ -112,7 +112,7 @@ class Proxy(proxy.Proxy): """ return self._create(_chassis.Chassis, **attrs) - def find_chassis(self, name_or_id, ignore_missing=True, *, details=True): + def find_chassis(self, name_or_id, ignore_missing=True): """Find a single chassis. :param str name_or_id: The ID of a chassis. @@ -120,19 +120,11 @@ class Proxy(proxy.Proxy): :class:`~openstack.exceptions.ResourceNotFound` will be raised when the chassis does not exist. When set to `True``, None will be returned when attempting to find a nonexistent chassis. - :param details: A boolean indicating whether the detailed information - for the chassis should be returned. - :returns: One :class:`~openstack.baremetal.v1.chassis.Chassis` object or None. """ - list_base_path = '/chassis/detail' if details else None - return self._find( - _chassis.Chassis, - name_or_id, - ignore_missing=ignore_missing, - list_base_path=list_base_path, - ) + return self._find(_chassis.Chassis, name_or_id, + ignore_missing=ignore_missing) def get_chassis(self, chassis, fields=None): """Get a specific chassis. @@ -308,7 +300,7 @@ class Proxy(proxy.Proxy): """ return self._create(_node.Node, **attrs) - def find_node(self, name_or_id, ignore_missing=True, *, details=True): + def find_node(self, name_or_id, ignore_missing=True): """Find a single node. :param str name_or_id: The name or ID of a node. @@ -316,18 +308,11 @@ class Proxy(proxy.Proxy): :class:`~openstack.exceptions.ResourceNotFound` will be raised when the node does not exist. When set to `True``, None will be returned when attempting to find a nonexistent node. - :param details: A boolean indicating whether the detailed information - for the node should be returned. :returns: One :class:`~openstack.baremetal.v1.node.Node` object or None. """ - list_base_path = '/nodes/detail' if details else None - return self._find( - _node.Node, - name_or_id, - ignore_missing=ignore_missing, - list_base_path=list_base_path, - ) + return self._find(_node.Node, name_or_id, + ignore_missing=ignore_missing) def get_node(self, node, fields=None): """Get a specific node. @@ -700,7 +685,7 @@ class Proxy(proxy.Proxy): """ return self._create(_port.Port, **attrs) - def find_port(self, name_or_id, ignore_missing=True, *, details=True): + def find_port(self, name_or_id, ignore_missing=True): """Find a single port. :param str name_or_id: The ID of a port. @@ -708,18 +693,11 @@ class Proxy(proxy.Proxy): :class:`~openstack.exceptions.ResourceNotFound` will be raised when the port does not exist. When set to `True``, None will be returned when attempting to find a nonexistent port. - :param details: A boolean indicating whether the detailed information - for every port should be returned. :returns: One :class:`~openstack.baremetal.v1.port.Port` object or None. """ - list_base_path = '/ports/detail' if details else None - return self._find( - _port.Port, - name_or_id, - ignore_missing=ignore_missing, - list_base_path=list_base_path, - ) + return self._find(_port.Port, name_or_id, + ignore_missing=ignore_missing) def get_port(self, port, fields=None): """Get a specific port. @@ -825,13 +803,7 @@ class Proxy(proxy.Proxy): """ return self._create(_portgroup.PortGroup, **attrs) - def find_port_group( - self, - name_or_id, - ignore_missing=True, - *, - details=True, - ): + def find_port_group(self, name_or_id, ignore_missing=True): """Find a single port group. :param str name_or_id: The name or ID of a portgroup. @@ -839,18 +811,11 @@ class Proxy(proxy.Proxy): :class:`~openstack.exceptions.ResourceNotFound` will be raised when the port group does not exist. When set to `True``, None will be returned when attempting to find a nonexistent port group. - :param details: A boolean indicating whether the detailed information - for the port group should be returned. :returns: One :class:`~openstack.baremetal.v1.port_group.PortGroup` object or None. """ - list_base_path = '/portgroups/detail' if details else None - return self._find( - _portgroup.PortGroup, - name_or_id, - ignore_missing=ignore_missing, - list_base_path=list_base_path, - ) + return self._find(_portgroup.PortGroup, name_or_id, + ignore_missing=ignore_missing) def get_port_group(self, port_group, fields=None): """Get a specific port group. @@ -1204,8 +1169,6 @@ class Proxy(proxy.Proxy): """ return self._create(_volumeconnector.VolumeConnector, **attrs) - # TODO(stephenfin): Delete this. You can't lookup a volume connector by - # name so this is identical to get_volume_connector def find_volume_connector(self, vc_id, ignore_missing=True): """Find a single volume connector. @@ -1220,11 +1183,8 @@ class Proxy(proxy.Proxy): :class:`~openstack.baremetal.v1.volumeconnector.VolumeConnector` object or None. """ - return self._find( - _volumeconnector.VolumeConnector, - vc_id, - ignore_missing=ignore_missing, - ) + return self._find(_volumeconnector.VolumeConnector, vc_id, + ignore_missing=ignore_missing) def get_volume_connector(self, volume_connector, fields=None): """Get a specific volume_connector. @@ -1349,8 +1309,6 @@ class Proxy(proxy.Proxy): """ return self._create(_volumetarget.VolumeTarget, **attrs) - # TODO(stephenfin): Delete this. You can't lookup a volume target by - # name so this is identical to get_volume_connector def find_volume_target(self, vt_id, ignore_missing=True): """Find a single volume target. @@ -1365,11 +1323,8 @@ class Proxy(proxy.Proxy): :class:`~openstack.baremetal.v1.volumetarget.VolumeTarget` object or None. """ - return self._find( - _volumetarget.VolumeTarget, - vt_id, - ignore_missing=ignore_missing, - ) + return self._find(_volumetarget.VolumeTarget, vt_id, + ignore_missing=ignore_missing) def get_volume_target(self, volume_target, fields=None): """Get a specific volume_target. diff --git a/openstack/tests/unit/baremetal/v1/test_proxy.py b/openstack/tests/unit/baremetal/v1/test_proxy.py index d3bf06a76..19efccc17 100644 --- a/openstack/tests/unit/baremetal/v1/test_proxy.py +++ b/openstack/tests/unit/baremetal/v1/test_proxy.py @@ -60,11 +60,7 @@ class TestChassis(TestBaremetalProxy): self.verify_create(self.proxy.create_chassis, chassis.Chassis) def test_find_chassis(self): - self.verify_find( - self.proxy.find_chassis, - chassis.Chassis, - expected_kwargs={'list_base_path': '/chassis/detail'}, - ) + self.verify_find(self.proxy.find_chassis, chassis.Chassis) def test_get_chassis(self): self.verify_get(self.proxy.get_chassis, chassis.Chassis, @@ -98,11 +94,7 @@ class TestNode(TestBaremetalProxy): self.verify_create(self.proxy.create_node, node.Node) def test_find_node(self): - self.verify_find( - self.proxy.find_node, - node.Node, - expected_kwargs={'list_base_path': '/nodes/detail'}, - ) + self.verify_find(self.proxy.find_node, node.Node) def test_get_node(self): self.verify_get(self.proxy.get_node, node.Node, @@ -148,11 +140,7 @@ class TestPort(TestBaremetalProxy): self.verify_create(self.proxy.create_port, port.Port) def test_find_port(self): - self.verify_find( - self.proxy.find_port, - port.Port, - expected_kwargs={'list_base_path': '/ports/detail'}, - ) + self.verify_find(self.proxy.find_port, port.Port) def test_get_port(self): self.verify_get(self.proxy.get_port, port.Port, diff --git a/releasenotes/notes/retrieve-detailed-view-for-find-proxy-methods-947a3280732c448a.yaml b/releasenotes/notes/retrieve-detailed-view-for-find-proxy-methods-947a3280732c448a.yaml index b15ba5fb2..347ac2aca 100644 --- a/releasenotes/notes/retrieve-detailed-view-for-find-proxy-methods-947a3280732c448a.yaml +++ b/releasenotes/notes/retrieve-detailed-view-for-find-proxy-methods-947a3280732c448a.yaml @@ -4,13 +4,6 @@ features: The following proxy ``find_*`` operations will now retrieve a detailed resource by default when retrieving by name: - * Bare metal (v1) - - * ``find_chassis`` - * ``find_node`` - * ``find_port`` - * ``find_port_group`` - * Block storage (v2) * ``find_volume``