From ac7e1e0baf7fd0439b0352954d354f5f1a51e439 Mon Sep 17 00:00:00 2001 From: Ali Ahmed Date: Wed, 15 Sep 2021 21:02:57 -0500 Subject: Move TPMRequiredToBoot under Boot for PATCH call TrustedModuleRequiredToBoot is a sub-parameter of the 'Boot' parameter. Edits the patch code to make sure the patch happens under '{"Boot":{"TrustedModuleRequiredToBoot": false}}', instead of current: '{"TrustedModuleRequiredToBoot":false}'. Testing: 1) Curl testing: curl -k -H "X-Auth-Token: $token" -X PATCH \ -d '{"Boot":{"TrustedModuleRequiredToBoot": true}}' \ https://${bmc}/redfish/v1/Systems/system curl -k -H "X-Auth-Token: $token" \ https://${bmc}/redfish/v1/Systems/system { ... "Boot": { "AutomaticRetryAttempts": 3, "AutomaticRetryConfig": "Disabled", "AutomaticRetryConfig@Redfish.AllowableValues": [ "Disabled", "RetryAttempts" ], "BootSourceOverrideEnabled": "Disabled", "BootSourceOverrideTarget": "BiosSetup", "BootSourceOverrideTarget@Redfish.AllowableValues": [ "None", "Pxe", "Hdd", "Cd", "Diags", "BiosSetup", "Usb" ], "TrustedModuleRequiredToBoot": "Required" }, ... } Signed-off-by: Ali Ahmed Change-Id: I70b26a8e3c7282fa628dcc149d1328a8dc9f0b8b --- redfish-core/lib/systems.hpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'redfish-core/lib/systems.hpp') diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp index 680a0ee7db..3e27241a7e 100644 --- a/redfish-core/lib/systems.hpp +++ b/redfish-core/lib/systems.hpp @@ -2778,15 +2778,12 @@ inline void requestRoutesSystems(App& app) std::optional assetTag; std::optional powerRestorePolicy; std::optional powerMode; - std::optional trustedModuleRequiredToBoot; if (!json_util::readJson( req, asyncResp->res, "IndicatorLED", indicatorLed, "LocationIndicatorActive", locationIndicatorActive, "Boot", bootProps, "WatchdogTimer", wdtTimerProps, "PowerRestorePolicy", powerRestorePolicy, "AssetTag", - assetTag, "PowerMode", powerMode, - "TrustedModuleRequiredToBoot", - trustedModuleRequiredToBoot)) + assetTag, "PowerMode", powerMode)) { return; } @@ -2818,13 +2815,16 @@ inline void requestRoutesSystems(App& app) std::optional bootType; std::optional bootEnable; std::optional automaticRetryConfig; + std::optional trustedModuleRequiredToBoot; if (!json_util::readJson( *bootProps, asyncResp->res, "BootSourceOverrideTarget", bootSource, "BootSourceOverrideMode", bootType, "BootSourceOverrideEnabled", bootEnable, - "AutomaticRetryConfig", automaticRetryConfig)) + "AutomaticRetryConfig", automaticRetryConfig, + "TrustedModuleRequiredToBoot", + trustedModuleRequiredToBoot)) { return; } @@ -2838,6 +2838,12 @@ inline void requestRoutesSystems(App& app) { setAutomaticRetry(asyncResp, *automaticRetryConfig); } + + if (trustedModuleRequiredToBoot) + { + setTrustedModuleRequiredToBoot( + asyncResp, *trustedModuleRequiredToBoot); + } } if (locationIndicatorActive) @@ -2866,12 +2872,6 @@ inline void requestRoutesSystems(App& app) { setPowerMode(asyncResp, *powerMode); } - - if (trustedModuleRequiredToBoot) - { - setTrustedModuleRequiredToBoot( - asyncResp, *trustedModuleRequiredToBoot); - } }); } -- cgit v1.2.3