Verify PSU is present before code update
When an Activation is set to the Activating state, it checks all the
PSUs in the system to see which ones are compatible. Compatibility is
determined based on the Model and Manufacturer properties. It performs a
code update only on compatible PSUs.
Update the Activation class to also check whether a PSU is present. A
code update should not be attempted on a missing PSU. The attempt will
fail, and that will cause the remaining PSUs to be skipped.
Tested:
* Activation::startActivation()
* Test where PSU is not present
* Verify it is skipped
* Test where PSU is present
* Verify the compatibility is checked
* Test where PSU is not compatible
* Verify it is skipped
* Test where PSU is compatible
* Verify it is code updated
* Activation::isPresent()
* Test where PSU is present
* Test where PSU is not present
* Test where a D-Bus error occurs
* Verify error is written to the journal
* Verify false is returned
Change-Id: I5647e51177d84d22f6ae5a38afa970243fe9ecdd
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
diff --git a/src/activation.hpp b/src/activation.hpp
index 015f524..092fe3d 100644
--- a/src/activation.hpp
+++ b/src/activation.hpp
@@ -231,6 +231,9 @@
/** @brief Finish PSU update */
void finishActivation();
+ /** @brief Check if the PSU is present */
+ bool isPresent(const std::string& psuInventoryPath);
+
/** @brief Check if the PSU is compatible with this software*/
bool isCompatible(const std::string& psuInventoryPath);