Fix publish a registry to verify messageId
- Base on the b304bd7965 commit, there is a potential bug here.
- Currently, the registry is only published when
`BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES` is disabled. In fact,
regardless of whether `BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES` is
enabled or disabled, the registry needs to be published.
Tested: built bmcweb repo successfully and validator passes.
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I2e9d96c3b3eef0606e35c146b3d77b5aa2bb066c
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
index 34af41a..fa4e41a 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
@@ -49,20 +49,6 @@
static constexpr const char* eventServiceFile =
"/var/lib/bmcweb/eventservice_config.json";
-#ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES
-static std::optional<boost::asio::posix::stream_descriptor> inotifyConn;
-static constexpr const char* redfishEventLogDir = "/var/log";
-static constexpr const char* redfishEventLogFile = "/var/log/redfish";
-static constexpr const size_t iEventSize = sizeof(inotify_event);
-static int inotifyFd = -1;
-static int dirWatchDesc = -1;
-static int fileWatchDesc = -1;
-
-// <ID, timestamp, RedfishLogId, registryPrefix, MessageId, MessageArgs>
-using EventLogObjectsType =
- std::tuple<std::string, std::string, std::string, std::string, std::string,
- std::vector<std::string>>;
-
namespace message_registries
{
inline boost::beast::span<const MessageEntry>
@@ -82,7 +68,24 @@
}
return boost::beast::span<const MessageEntry>(openbmc::registry);
}
+} // namespace message_registries
+#ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES
+static std::optional<boost::asio::posix::stream_descriptor> inotifyConn;
+static constexpr const char* redfishEventLogDir = "/var/log";
+static constexpr const char* redfishEventLogFile = "/var/log/redfish";
+static constexpr const size_t iEventSize = sizeof(inotify_event);
+static int inotifyFd = -1;
+static int dirWatchDesc = -1;
+static int fileWatchDesc = -1;
+
+// <ID, timestamp, RedfishLogId, registryPrefix, MessageId, MessageArgs>
+using EventLogObjectsType =
+ std::tuple<std::string, std::string, std::string, std::string, std::string,
+ std::vector<std::string>>;
+
+namespace message_registries
+{
static const Message*
getMsgFromRegistry(const std::string& messageKey,
const boost::beast::span<const MessageEntry>& registry)