control: Load only 1 pcie_cards.json

The pcie_cards.json file contains PCIe cards that need special fan floor
values.  The previous code would attempt to load multiple files, based
on the thinking that there might be a common file that is shared between
systems and then other system specific files with just the cards that
are different.

In practice this feature was never used, and made systems harder to
patch in /etc/ since even after a file was found in /etc the file would
also be loaded out of /usr, overwriting the values.

Tested:
A file was put in each non default location of:

```
/etc/phosphor-fan-presence/control/
/etc/phosphor-fan-presence/control/com.ibm.Hardware.Chassis.Model.Rainier4U/

/usr/share/phosphor-fan-presence/control/
/usr/share/phosphor-fan-presence/control/com.ibm.Hardware.Chassis.Model.Rainier/
```

With the existing file in flash at:
/usr/share/ ... /com.ibm.Hardware.Chassis.Model.Rainier4U/

And in each case the correct file was chosen.  Verified using the traces
shown on startup like:

```
Loading configuration from /etc/phosphor-fan-presence/control/pcie_cards.json
```

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I14b849a2bff65402508ef92e293f3237729721e5
diff --git a/control/json/utils/pcie_card_metadata.cpp b/control/json/utils/pcie_card_metadata.cpp
index c8c1b37..1e392af 100644
--- a/control/json/utils/pcie_card_metadata.cpp
+++ b/control/json/utils/pcie_card_metadata.cpp
@@ -39,9 +39,33 @@
 {
     const auto defaultPath = fs::path{"control"} / cardFileName;
 
-    // Look in the override location first
+    // First look in /etc/phosphor-fan-presence/control/
     auto confFile = fs::path{confOverridePath} / defaultPath;
 
+    // Next look in the system subdirectories, first under /etc then /usr.
+    if (!fs::exists(confFile))
+    {
+        for (const auto& systemName : systemNames)
+        {
+            const auto basePath =
+                fs::path{"control"} / systemName / cardFileName;
+
+            // Look in the /etc override location first
+            confFile = fs::path{confOverridePath} / basePath;
+
+            if (!fs::exists(confFile))
+            {
+                confFile = fs::path{confBasePath} / basePath;
+            }
+
+            if (fs::exists(confFile))
+            {
+                break;
+            }
+        }
+    }
+
+    // Next look in /usr/share/phosphor-fan-presence/control/
     if (!fs::exists(confFile))
     {
         confFile = fs::path{confBasePath} / defaultPath;
@@ -60,37 +84,6 @@
                                      confFile.string())
                              .c_str());
     }
-
-    // Go from least specific to most specific in the system names so files in
-    // the latter category can override ones in the former.
-    for (auto nameIt = systemNames.rbegin(); nameIt != systemNames.rend();
-         ++nameIt)
-    {
-        const auto basePath = fs::path{"control"} / *nameIt / cardFileName;
-
-        // Look in the override location first
-        auto confFile = fs::path{confOverridePath} / basePath;
-
-        if (!fs::exists(confFile))
-        {
-            confFile = fs::path{confBasePath} / basePath;
-        }
-
-        if (fs::exists(confFile))
-        {
-            FlightRecorder::instance().log(
-                "main", std::format("Loading configuration from {}",
-                                    confFile.string()));
-            load(JsonConfig::load(confFile));
-            FlightRecorder::instance().log(
-                "main", std::format("Configuration({}) loaded successfully",
-                                    confFile.string()));
-            log<level::INFO>(
-                std::format("Configuration({}) loaded successfully",
-                            confFile.string())
-                    .c_str());
-        }
-    }
 }
 
 void PCIeCardMetadata::load(const nlohmann::json& json)
diff --git a/control/json/utils/pcie_card_metadata.hpp b/control/json/utils/pcie_card_metadata.hpp
index c6b2083..dcdc9e5 100644
--- a/control/json/utils/pcie_card_metadata.hpp
+++ b/control/json/utils/pcie_card_metadata.hpp
@@ -33,8 +33,7 @@
  * fan floor index or temp sensor name based on its metadata, which
  * consists of 4 properties from the PCIeDevice D-Bus interface.
  *
- * The metadata is stored in one or more (see loadCards) JSON files, which
- * look like:
+ * The metadata is stored in a JSON file, which looks like:
  *  {
  *    "cards": [
  *      {
@@ -116,12 +115,8 @@
      * It will load a pcie_cards.json file in the default location if it
      * is present.
      *
-     * If systemNames isn't empty, it will load in any 'pcie_cards.json'
-     * files it finds in directories based on those names, overwriting any
-     * entries that were in any previous files.  This allows different
-     * floor indexes for some cards for the different systems in a flash
-     * image without needing to specify every possible card in every
-     * system specific JSON file.
+     * If systemNames isn't empty, it will load the first 'pcie_cards.json'
+     * files it finds in directories based on those names.
      *
      * If no valid config files are found it will throw an exception.
      *