Create active association on startup
Create active association on startup for
active PNOR versions.
Change-Id: I8f7657e6c332759642ecc8f42c9caab14db1289b
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/item_updater.cpp b/item_updater.cpp
index 101bc00..fcec2b1 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -96,9 +96,15 @@
{
// Determine the Activation state by processing the given image dir.
auto activationState = server::Activation::Activations::Invalid;
+ AssociationList associations = {};
if (ItemUpdater::validateSquashFSImage(filePath) == 0)
{
activationState = server::Activation::Activations::Ready;
+ // Create an association to the host inventory item
+ associations.emplace_back(std::make_tuple(
+ ACTIVATION_FWD_ASSOCIATION,
+ ACTIVATION_REV_ASSOCIATION,
+ HOST_INVENTORY_PATH));
}
fs::path manifestPath(filePath);
@@ -107,12 +113,6 @@
std::map<std::string, std::string>
{{"extended_version", ""}})).begin()->second;
- // Create an association to the host inventory item
- AssociationList associations{(std::make_tuple(
- ACTIVATION_FWD_ASSOCIATION,
- ACTIVATION_REV_ASSOCIATION,
- HOST_INVENTORY_PATH))};
-
activations.insert(std::make_pair(
versionId,
std::make_unique<Activation>(
@@ -187,13 +187,19 @@
auto id = iter.path().native().substr(PNOR_RO_PREFIX_LEN);
auto purpose = server::Version::VersionPurpose::Host;
auto path = fs::path(SOFTWARE_OBJPATH) / id;
+ AssociationList associations = {};
+ if (activationState == server::Activation::Activations::Active)
+ {
+ // Create an association to the host inventory item
+ associations.emplace_back(std::make_tuple(
+ ACTIVATION_FWD_ASSOCIATION,
+ ACTIVATION_REV_ASSOCIATION,
+ HOST_INVENTORY_PATH));
- // Create an association to the host inventory item
- AssociationList associations{(std::make_tuple(
- ACTIVATION_FWD_ASSOCIATION,
- ACTIVATION_REV_ASSOCIATION,
- HOST_INVENTORY_PATH))};
+ // Create an active association since this image is active
+ createActiveAssociation(path);
+ }
// Create Activation instance for this version.
activations.insert(std::make_pair(