Add option to disable getActiveSoftwareVersionInfo
Add metion option `get-dbus-active-software` to allow us to disable
calling getActiveSoftwareVersionInfo when we expect it to be failing and
depend completely on dev_id.json for the version.
Tested:
Build with both options and works fine.
Change-Id: Icad3ad72521af35370e74cea36aa12085448dc53
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/apphandler.cpp b/apphandler.cpp
index d0d77f8..6591afa 100644
--- a/apphandler.cpp
+++ b/apphandler.cpp
@@ -619,8 +619,6 @@
>
ipmiAppGetDeviceId([[maybe_unused]] ipmi::Context::ptr ctx)
{
- int r = -1;
- Revision rev = {0, 0, 0, 0};
static struct
{
uint8_t id;
@@ -633,13 +631,17 @@
uint32_t aux;
} devId;
static bool dev_id_initialized = false;
- static bool haveBMCVersion = false;
static bool defaultActivationSetting = true;
const char* filename = "/usr/share/ipmi-providers/dev_id.json";
constexpr auto ipmiDevIdStateShift = 7;
constexpr auto ipmiDevIdFw1Mask = ~(1 << ipmiDevIdStateShift);
+
+#ifdef GET_DBUS_ACTIVE_SOFTWARE
+ static bool haveBMCVersion = false;
if (!haveBMCVersion || !dev_id_initialized)
{
+ int r = -1;
+ Revision rev = {0, 0, 0, 0};
try
{
auto version = getActiveSoftwareVersionInfo(ctx);
@@ -666,6 +668,7 @@
haveBMCVersion = true;
}
}
+#endif
if (!dev_id_initialized)
{
// IPMI Spec version 2.0