Skip to content

Commit 2a1c39b

Browse files
authored
Merge pull request #593 from souvik1914581/sr_vpdToolDumpInvAddUnitsBackToTable
Filter "unit" object paths for dump inventory table only, add -u flag to vpd-tool writeKeyword
2 parents 6a8e56f + 2505e02 commit 2a1c39b

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

vpd-tool/src/vpd_tool.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -722,14 +722,6 @@ int VpdTool::dumpInventory(bool i_dumpTable) const noexcept
722722

723723
std::for_each(l_objectPaths.begin(), l_objectPaths.end(),
724724
[&](const auto& l_objectPath) {
725-
// if object path ends in "unit([0-9][0-9]?)", skip the object
726-
// path.
727-
if (std::regex_search(l_objectPath,
728-
std::regex("unit([0-9][0-9]?)")))
729-
{
730-
return;
731-
}
732-
733725
const auto l_fruJson = getFruProperties(l_objectPath);
734726
if (!l_fruJson.empty())
735727
{
@@ -775,6 +767,14 @@ int VpdTool::dumpInventory(bool i_dumpTable) const noexcept
775767
// iterate through the json array
776768
for (const auto& l_fruEntry : l_resultInJson[0].items())
777769
{
770+
// if object path ends in "unit([0-9][0-9]?)", skip adding
771+
// the object path in the table
772+
if (std::regex_search(l_fruEntry.key(),
773+
std::regex("unit([0-9][0-9]?)")))
774+
{
775+
continue;
776+
}
777+
778778
std::vector<std::string> l_row;
779779
for (const auto& l_column : l_tableColumns)
780780
{
@@ -806,6 +806,7 @@ int VpdTool::dumpInventory(bool i_dumpTable) const noexcept
806806
{
807807
// print JSON to console
808808
utils::printJson(l_resultInJson);
809+
l_rc = constants::SUCCESS;
809810
}
810811
}
811812
}
@@ -1101,6 +1102,7 @@ int VpdTool::handleMoreOption(
11011102
}
11021103
else
11031104
{
1105+
std::cout << "No mismatch found." << std::endl << std::endl;
11041106
printFixSystemVpdOption(types::UserOption::NewValueOnBoth);
11051107
printFixSystemVpdOption(types::UserOption::SkipCurrent);
11061108
printFixSystemVpdOption(types::UserOption::Exit);

vpd-tool/src/vpd_tool_main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,13 @@ void updateFooter(CLI::App& i_app)
195195
"Write:\n"
196196
" IPZ Format:\n"
197197
" On DBus: "
198-
"vpd-tool -w -O <DBus Object Path> -R <Record Name> -K <Keyword Name> -V <Keyword Value>\n"
198+
"vpd-tool -w/-u -O <DBus Object Path> -R <Record Name> -K <Keyword Name> -V <Keyword Value>\n"
199199
" On DBus, take keyword value from file:\n"
200-
" vpd-tool -w -O <DBus Object Path> -R <Record Name> -K <Keyword Name> --file <File Path>\n"
200+
" vpd-tool -w/-u -O <DBus Object Path> -R <Record Name> -K <Keyword Name> --file <File Path>\n"
201201
" On hardware: "
202-
"vpd-tool -w -H -O <EEPROM Path> -R <Record Name> -K <Keyword Name> -V <Keyword Value>\n"
202+
"vpd-tool -w/-u -H -O <EEPROM Path> -R <Record Name> -K <Keyword Name> -V <Keyword Value>\n"
203203
" On hardware, take keyword value from file:\n"
204-
" vpd-tool -w -H -O <EEPROM Path> -R <Record Name> -K <Keyword Name> --file <File Path>\n"
204+
" vpd-tool -w/-u -H -O <EEPROM Path> -R <Record Name> -K <Keyword Name> --file <File Path>\n"
205205
"Dump Object:\n"
206206
" From DBus to console: "
207207
"vpd-tool -o -O <DBus Object Path>\n"
@@ -256,7 +256,7 @@ int main(int argc, char** argv)
256256
auto l_writeFlag =
257257
l_app
258258
.add_flag(
259-
"--writeKeyword, -w",
259+
"--writeKeyword, -w,--updateKeyword, -u",
260260
"Write keyword, Note: Irrespective of DBus or hardware path provided, primary and backup, redundant EEPROM(if any) paths will get updated with given key value")
261261
->needs(l_objectOption)
262262
->needs(l_recordOption)

0 commit comments

Comments
 (0)