diff options
author | Saqib Khan <khansa@us.ibm.com> | 2017-10-16 14:32:30 -0500 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-10-25 13:10:12 +0000 |
commit | d377ba1f91a32c83c6dc1687ac9fc767587f4c7a (patch) | |
tree | ee09945809719c6a02871b9454effce9f59fcf3b | |
parent | 9953e69b6700d42db8e67d797d2f7920fd978894 (diff) | |
download | phosphor-bmc-code-mgmt-d377ba1f91a32c83c6dc1687ac9fc767587f4c7a.tar.gz phosphor-bmc-code-mgmt-d377ba1f91a32c83c6dc1687ac9fc767587f4c7a.zip |
Move duplicate image upload log inside image_manager
The item_updater is called multiple times to createActivation
object when a new image is uploaded. This ends up producing a
log in the journal suggesting the image was already uploaded
even if the image didn't exist before.
Therefore moving the log inside the image_mananger so that its
called once when the image is uploaded.
Resolves openbmc/openbmc#2261
Change-Id: Ia6590a3a77ccb577c65803de3233b06e7bfb1320
Signed-off-by: Saqib Khan <khansa@us.ibm.com>
-rw-r--r-- | image_manager.cpp | 24 | ||||
-rw-r--r-- | item_updater.cpp | 5 |
2 files changed, 16 insertions, 13 deletions
diff --git a/image_manager.cpp b/image_manager.cpp index 206722c..6f49f5d 100644 --- a/image_manager.cpp +++ b/image_manager.cpp @@ -160,14 +160,22 @@ int Manager::processImage(const std::string& tarFilePath) // Create Version object auto objPath = std::string{SOFTWARE_OBJPATH} + '/' + id; - this->versions.insert(std::make_pair( - id, - std::make_unique<Version>( - this->bus, - objPath, - version, - purpose, - imageDirPath.string()))); + if (versions.find(id) == versions.end()) + { + this->versions.insert(std::make_pair( + id, + std::make_unique<Version>( + this->bus, + objPath, + version, + purpose, + imageDirPath.string()))); + } + else + { + log<level::INFO>("Software Object with the same version already exists", + entry("VERSION_ID=%s", id)); + } return 0; } diff --git a/item_updater.cpp b/item_updater.cpp index 490567c..2c23b93 100644 --- a/item_updater.cpp +++ b/item_updater.cpp @@ -137,11 +137,6 @@ void ItemUpdater::createActivation(sdbusplus::message::message& msg) purpose, filePath))); } - else - { - log<level::INFO>("Software Object with the same version already exists", - entry("VERSION_ID=%s", versionId)); - } return; } |