VPD Tool : Force Collect On Hardware
This commit adds an additional option called --forceReset
in the vpd-tool.
This option is used to restart the Inventory Manager service
and retrigger the udev events which launches the VPD services.
How to use the option?
./vpd-tool --forceReset/-f/-F
This option does not take any arguments.
Tested on simics.
Signed-off-by: PriyangaRamasamy <priyanga24@in.ibm.com>
Change-Id: Icd1ad30389432f731f21cc84999f7a54fcbbec65
diff --git a/vpd_tool.cpp b/vpd_tool.cpp
index 0514cc5..9129eca 100644
--- a/vpd_tool.cpp
+++ b/vpd_tool.cpp
@@ -60,6 +60,10 @@
->needs(kw)
->needs(valOption);
+ auto forceResetFlag = app.add_flag(
+ "--forceReset, -f, -F", "Force Collect for Hardware. { vpd-tool-exe "
+ "--forceReset/-f/-F }");
+
CLI11_PARSE(app, argc, argv);
ifstream inventoryJson(INVENTORY_JSON);
@@ -93,6 +97,12 @@
rc = vpdToolObj.updateKeyword();
}
+ else if (*forceResetFlag)
+ {
+ VpdTool vpdToolObj;
+ vpdToolObj.forceReset(jsObject);
+ }
+
else
{
throw runtime_error("One of the valid options is required. Refer "