Add check in requestRoutesEventLogService

Analogous to the other ComputerSystem EventLog routes, return early if
running on multi-host. EventLog should not be served under the
ComputerSystem resource when running on multi-host. As part of the
process, also put the lambda into a separate function.

Tested: Inspection only. Code compiles.

Change-Id: I69bb1fa8e7de503b1fb4d91b9e443c83f0f07f6a
Signed-off-by: Oliver Brewka <oliver.brewka@9elements.com>
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 982f74e..3b7f8cf 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -1011,29 +1011,6 @@
         });
 }
 
-inline void requestRoutesSystemsEventLogService(App& app)
-{
-    BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/LogServices/EventLog/")
-        .privileges(redfish::privileges::getLogService)
-        .methods(boost::beast::http::verb::get)(
-            [&app](const crow::Request& req,
-                   const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-                   const std::string& systemName) {
-                if (!redfish::setUpRedfishRoute(app, req, asyncResp))
-                {
-                    return;
-                }
-                if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
-                {
-                    messages::resourceNotFound(asyncResp->res, "ComputerSystem",
-                                               systemName);
-                    return;
-                }
-                eventlog_utils::handleSystemsAndManagersEventLogServiceGet(
-                    asyncResp, eventlog_utils::LogServiceParent::Systems);
-            });
-}
-
 inline void handleBMCLogServicesCollectionGet(
     crow::App& app, const crow::Request& req,
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
@@ -1122,6 +1099,31 @@
     }
 }
 
+inline void handleSystemsEventLogServiceGet(
+    crow::App& app, const crow::Request& req,
+    const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+    const std::string& systemName)
+{
+    if (!redfish::setUpRedfishRoute(app, req, asyncResp))
+    {
+        return;
+    }
+    if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
+    {
+        messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+                                   systemName);
+        return;
+    }
+    if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
+    {
+        messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+                                   systemName);
+        return;
+    }
+    eventlog_utils::handleSystemsAndManagersEventLogServiceGet(
+        asyncResp, eventlog_utils::LogServiceParent::Systems);
+}
+
 inline void requestRoutesBMCLogServiceCollection(App& app)
 {
     BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/LogServices/")
@@ -2163,4 +2165,13 @@
                     crashdumpObject, crashdumpPath, iface, method);
             });
 }
+
+inline void requestRoutesSystemsEventLogService(App& app)
+{
+    BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/LogServices/EventLog/")
+        .privileges(redfish::privileges::getLogService)
+        .methods(boost::beast::http::verb::get)(
+            std::bind_front(handleSystemsEventLogServiceGet, std::ref(app)));
+}
+
 } // namespace redfish