Skip to content

Commit 6d1818b

Browse files
author
Souvik Roy
committed
vpd-tool mfgClean: Sync BIOS attributes stub
This commit adds --syncBiosAttributes flag to vpd-tool --mfgClean option. The changes in this commit allows user to specify --syncBiosAttributes along with --mfgClean. Note: This is just a stub implementation of --syncBiosAttributes. Change-Id: I7bdda2c4c237476ac4f9d718960fe35c12b30580 Signed-off-by: Souvik Roy <[email protected]>
1 parent 2fed181 commit 6d1818b

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

vpd-tool/include/vpd_tool.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,12 @@ class VpdTool
259259
* 3. D-Bus cache.
260260
* 4. Backup path.
261261
*
262+
* @param[in] i_syncBiosAttributes - Flag which specifies whether BIOS
263+
* attribute related keywords need to be synced from BIOS Config Manager
264+
*
262265
* @return On success returns 0, otherwise returns -1.
263266
*/
264-
int cleanSystemVpd() const noexcept;
267+
int cleanSystemVpd(bool i_syncBiosAttributes = false) const noexcept;
265268

266269
/**
267270
* @brief Dump all the inventory objects in JSON or table format to console.

vpd-tool/src/vpd_tool.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,12 @@ nlohmann::json VpdTool::getBackupRestoreCfgJsonObj() const noexcept
374374
return l_parsedBackupRestoreJson;
375375
}
376376

377-
int VpdTool::cleanSystemVpd() const noexcept
377+
int VpdTool::cleanSystemVpd(bool i_syncBiosAttributes) const noexcept
378378
{
379379
try
380380
{
381+
(void)i_syncBiosAttributes;
382+
381383
// get the keyword map from backup_restore json
382384
// iterate through the keyword map get default value of
383385
// l_keywordName.

vpd-tool/src/vpd_tool_main.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111
*
1212
* @param[in] i_mfgCleanConfirmFlag - Confirmation flag to perform manufacturing
1313
* clean.
14+
* @param[in] i_mfgCleanSyncBiosAttributesFlag - Flag which specifies whether
15+
* BIOS attribute related keywords need to be synced from BIOS Config Manager
1416
*
1517
* @return Status returned by cleanSystemVpd operation, success otherwise.
1618
*/
17-
int doMfgClean(const auto& i_mfgCleanConfirmFlag)
19+
int doMfgClean(const auto& i_mfgCleanConfirmFlag,
20+
const auto& i_mfgCleanSyncBiosAttributesFlag)
1821
{
1922
if (i_mfgCleanConfirmFlag->empty())
2023
{
@@ -31,7 +34,8 @@ int doMfgClean(const auto& i_mfgCleanConfirmFlag)
3134
}
3235

3336
vpd::VpdTool l_vpdToolObj;
34-
return l_vpdToolObj.cleanSystemVpd();
37+
return l_vpdToolObj.cleanSystemVpd(
38+
!i_mfgCleanSyncBiosAttributesFlag->empty());
3539
}
3640

3741
/**
@@ -210,6 +214,8 @@ void updateFooter(CLI::App& i_app)
210214
"MfgClean:\n"
211215
" Flag to clean and reset specific keywords on system VPD to its default value.\n"
212216
" vpd-tool --mfgClean\n"
217+
" To sync BIOS attribute related keywords with BIOS Config Manager:\n"
218+
" vpd-tool --mfgClean --syncBiosAttributes\n"
213219
"Dump Inventory:\n"
214220
" From DBus to console in JSON format: "
215221
"vpd-tool -i\n"
@@ -286,6 +292,10 @@ int main(int argc, char** argv)
286292
auto l_dumpInventoryTableFlag =
287293
l_app.add_flag("--table, -t", "Dump inventory in table format");
288294

295+
auto l_mfgCleanSyncBiosAttributesFlag = l_app.add_flag(
296+
"--syncBiosAttributes, -s",
297+
"Sync BIOS attribute related keywords from BIOS Config Manager");
298+
289299
CLI11_PARSE(l_app, argc, argv);
290300

291301
if (checkOptionValuePair(l_objectOption, l_vpdPath, l_recordOption,
@@ -321,7 +331,8 @@ int main(int argc, char** argv)
321331

322332
if (!l_mfgCleanFlag->empty())
323333
{
324-
return doMfgClean(l_mfgCleanConfirmFlag);
334+
return doMfgClean(l_mfgCleanConfirmFlag,
335+
l_mfgCleanSyncBiosAttributesFlag);
325336
}
326337

327338
if (!l_dumpInventoryFlag->empty())

0 commit comments

Comments
 (0)