From 6a0fd31a0324d79ae0eaff011c3eb2a99a691812 Mon Sep 17 00:00:00 2001
From: "Dr. Jens Harbott" <frickler@offenerstapel.de>
Date: Thu, 5 Jan 2023 12:46:56 +0000
Subject: [PATCH] Revert "Add 'details' parameter to various 'find' proxy
 methods"

This partially reverts commit f9a3cc2f135e5c28fa1e046bb1ca034be36be9aa.

Reason for revert: The change to the baremetal functions is not working,
this part of the original change is reverted here.

Change-Id: Icc70bbdc06b5f32722a93775aee2da4d7b7ca4ae
---
 openstack/baremetal/v1/_proxy.py              | 77 ++++---------------
 .../tests/unit/baremetal/v1/test_proxy.py     | 18 +----
 ...r-find-proxy-methods-947a3280732c448a.yaml |  7 --
 3 files changed, 19 insertions(+), 83 deletions(-)

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``