summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChicago Duan <duanzhijia01@inspur.com>2019-07-15 09:22:08 +0300
committerEd Tanous <ed.tanous@intel.com>2019-07-30 19:21:57 +0300
commit336e96c667adf8401c8ed772d681a17c35b94b44 (patch)
tree86b42a4a23b5aaa21e6206bb2cfc80dccbdcace2
parent2c0feb0085ac3cc11c6fd77df7a8c7701f38fea5 (diff)
downloadbmcweb-336e96c667adf8401c8ed772d681a17c35b94b44.tar.xz
Redfish:Support to Delete a single event log
Tested:Use redfish to delete a single event log Before: curl -k -H "X-Auth-Token: $bmc_token" -X DELETE https://${bmc}/redfish/v1/Systems/system/LogServices/EventLog/Entries/2 -d '{"[]"}' Method Not Allowed After: curl -k -H "X-Auth-Token: $bmc_token" -X DELETE https://${bmc}/redfish/v1/Systems/system/LogServices/EventLog/Entries/2 -d '{"[]"}' No error response,and the entry 2 is deleted. Signed-off-by: Chicago Duan <duanzhijia01@inspur.com> Change-Id: I31e4470d73b72012b8727d466530202e2609000d
-rw-r--r--redfish-core/lib/log_services.hpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index cfccd61a91..c74bfa2986 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -1011,6 +1011,47 @@ class DBusEventLogEntry : public Node
"org.freedesktop.DBus.Properties", "GetAll",
"xyz.openbmc_project.Logging.Entry");
}
+
+ void doDelete(crow::Response &res, const crow::Request &req,
+ const std::vector<std::string> &params) override
+ {
+
+ BMCWEB_LOG_DEBUG << "Do delete single event entries.";
+
+ auto asyncResp = std::make_shared<AsyncResp>(res);
+
+ if (params.size() != 1)
+ {
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ std::string entryID = params[0];
+
+ dbus::utility::escapePathForDbus(entryID);
+
+ // Process response from Logging service.
+ auto respHandler = [asyncResp](const boost::system::error_code ec) {
+ BMCWEB_LOG_DEBUG << "EventLogEntry (DBus) doDelete callback: Done";
+ if (ec)
+ {
+ // TODO Handle for specific error code
+ BMCWEB_LOG_ERROR
+ << "EventLogEntry (DBus) doDelete respHandler got error "
+ << ec;
+ asyncResp->res.result(
+ boost::beast::http::status::internal_server_error);
+ return;
+ }
+
+ asyncResp->res.result(boost::beast::http::status::ok);
+ };
+
+ // Make call to Logging service to request Delete Log
+ crow::connections::systemBus->async_method_call(
+ respHandler, "xyz.openbmc_project.Logging",
+ "/xyz/openbmc_project/logging/entry/" + entryID,
+ "xyz.openbmc_project.Object.Delete", "Delete");
+ }
};
class BMCLogServiceCollection : public Node