summaryrefslogtreecommitdiffstats
path: root/watch.cpp
diff options
context:
space:
mode:
authorGunnar Mills <gmills@us.ibm.com>2017-04-19 15:42:47 -0500
committerPatrick Williams <patrick@stwcx.xyz>2017-05-11 02:10:53 +0000
commite91d321a9671ea317a203d128b67e2b320def58f (patch)
tree8b2ef98e4b652b455ef99ef03845b15c14e56066 /watch.cpp
parent368cfcbb4755f6b78f6f0c5976aece4ce823f4ec (diff)
downloadphosphor-bmc-code-mgmt-e91d321a9671ea317a203d128b67e2b320def58f.tar.gz
phosphor-bmc-code-mgmt-e91d321a9671ea317a203d128b67e2b320def58f.zip
Call processImage from inotify
Change-Id: I0b748f93f8e34552cef67616317c28660284ac99 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
Diffstat (limited to 'watch.cpp')
-rw-r--r--watch.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/watch.cpp b/watch.cpp
index a690c57..ae1e419 100644
--- a/watch.cpp
+++ b/watch.cpp
@@ -7,6 +7,7 @@
#include <phosphor-logging/log.hpp>
#include "config.h"
#include "watch.hpp"
+#include "image_manager.hpp"
namespace phosphor
{
@@ -15,6 +16,7 @@ namespace software
namespace manager
{
+using namespace phosphor::logging;
using namespace std::string_literals;
Watch::Watch(sd_event* loop)
@@ -86,11 +88,14 @@ int Watch::callback(sd_event_source* s,
auto event = reinterpret_cast<inotify_event*>(&buffer[offset]);
if ((event->mask & IN_CLOSE_WRITE) && !(event->mask & IN_ISDIR))
{
- // TODO: openbmc/openbmc#1352 - invoke method (which takes uploaded
- // filepath) to construct software version d-bus objects.
- // For now, log the image filename.
- using namespace phosphor::logging;
- log<level::INFO>(event->name);
+ auto rc = processImage(std::string{IMG_UPLOAD_DIR} +
+ '/' + event->name);
+ if (rc < 0)
+ {
+ log<level::ERR>("Error processing image",
+ entry("IMAGE=%s", std::string{event->name}));
+ }
+
}
offset += offsetof(inotify_event, name) + event->len;
OpenPOWER on IntegriCloud