Use 'type' of delete action in the log_handler builder
This was a bug where the 'type' of the open action was being used rather
than using the 'type' in the delete action config.
Tested:
- Created LogHandler with the following config.
```
{
"blob": "/log/log-blob-name",
"handler": {
"type": "file",
"path": "/var/run/log-blob-file.log"
},
"actions": {
"open": {
"type": "skip"
},
"delete": {
"type": "systemd",
"unit": "log-blob-delete.service"
}
},
```
- Checked log-blob-delete.service was run when blob was deleted
Change-Id: I2e4c783d9b159ad269ef06721d872bb8052af81c
Signed-off-by: Brennan Swanton <brennanswanton@google.com>
diff --git a/bmc/log-handler/log_handlers_builder.cpp b/bmc/log-handler/log_handlers_builder.cpp
index 902b817..d9c7fb2 100644
--- a/bmc/log-handler/log_handlers_builder.cpp
+++ b/bmc/log-handler/log_handlers_builder.cpp
@@ -90,7 +90,7 @@
}
const auto& onDelete = a.at("delete");
- const std::string& onDeleteType = onOpen.at("type");
+ const std::string& onDeleteType = onDelete.at("type");
if (onDeleteType == "systemd")
{
pack->onDelete = std::move(buildSystemd(onDelete));