bios: better error messages for fetching config
Tested: In case of a missing property, it is clearly shown what is
missing.
Change-Id: I1e5ec34ed93e979105a08a451ce22890f0791918
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/bios/bios_software_manager.cpp b/bios/bios_software_manager.cpp
index 61a9fef..163c827 100644
--- a/bios/bios_software_manager.cpp
+++ b/bios/bios_software_manager.cpp
@@ -27,14 +27,26 @@
std::string configIface =
"xyz.openbmc_project.Configuration." + config.configType;
- std::optional<int64_t> spiControllerIndex =
+ std::optional<uint64_t> spiControllerIndex =
co_await dbusGetRequiredProperty<uint64_t>(
ctx, service, path, configIface, "SPIControllerIndex");
- std::optional<int64_t> spiDeviceIndex =
+ if (!spiControllerIndex.has_value())
+ {
+ error("Missing property: SPIControllerIndex");
+ co_return false;
+ }
+
+ std::optional<uint64_t> spiDeviceIndex =
co_await dbusGetRequiredProperty<uint64_t>(
ctx, service, path, configIface, "SPIDeviceIndex");
+ if (!spiDeviceIndex.has_value())
+ {
+ error("Missing property: SPIDeviceIndex");
+ co_return false;
+ }
+
const std::string configIfaceMux = configIface + ".MuxOutputs";
std::vector<std::string> names;
@@ -61,12 +73,6 @@
values.push_back((polarity == "High") ? 1 : 0);
}
- if (!spiControllerIndex.has_value() || !spiDeviceIndex.has_value())
- {
- error("Error: Missing property");
- co_return false;
- }
-
enum FlashLayout layout = flashLayoutFlat;
enum FlashTool tool = flashToolNone;