diff options
author | Gunnar Mills <gmills@us.ibm.com> | 2017-04-27 15:49:03 -0500 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-05-24 16:50:35 +0000 |
commit | 3027bba9d5c61c51f3b3339cdb8f8fa3f5c8c483 (patch) | |
tree | e14a268f6a97386fc137fdbaf92c01a00533dd84 /watch.cpp | |
parent | 19e4ce5dfeadd5550a30465e5bc80cb85cadb94e (diff) | |
download | phosphor-bmc-code-mgmt-3027bba9d5c61c51f3b3339cdb8f8fa3f5c8c483.tar.gz phosphor-bmc-code-mgmt-3027bba9d5c61c51f3b3339cdb8f8fa3f5c8c483.zip |
Create version dbus object
Read the version and purpose from the manifest.
Compute the id from the version. Create the image dir,
<IMAGE_UPLOAD_DIR>/<id>/. Create the version object
with the version, purpose, id and image dir path.
Change-Id: I6d2d710fb8eeeda085af8ab116f2dafc720a2ade
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
Diffstat (limited to 'watch.cpp')
-rw-r--r-- | watch.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -21,7 +21,9 @@ using namespace phosphor::logging; using namespace std::string_literals; namespace fs = std::experimental::filesystem; -Watch::Watch(sd_event* loop) +Watch::Watch(sd_event* loop, + std::function<int(std::string&)> imageCallback) : imageCallback( + imageCallback) { // Check if IMAGE DIR exists. fs::path imgDirPath(IMG_UPLOAD_DIR); @@ -100,12 +102,12 @@ 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)) { - auto rc = processImage(std::string{IMG_UPLOAD_DIR} + - '/' + event->name); + auto tarballPath = std::string{IMG_UPLOAD_DIR} + '/' + event->name; + auto rc = static_cast<Watch*>(userdata)->imageCallback(tarballPath); if (rc < 0) { log<level::ERR>("Error processing image", - entry("IMAGE=%s", std::string{event->name})); + entry("IMAGE=%s", tarballPath)); } } |