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 <ama213000@gmail.com>
Change-Id: I70b26a8e3c7282fa628dcc149d1328a8dc9f0b8b
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 680a0ee..3e27241 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -2778,15 +2778,12 @@
std::optional<std::string> assetTag;
std::optional<std::string> powerRestorePolicy;
std::optional<std::string> powerMode;
- std::optional<bool> 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 @@
std::optional<std::string> bootType;
std::optional<std::string> bootEnable;
std::optional<std::string> automaticRetryConfig;
+ std::optional<bool> 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 @@
{
setAutomaticRetry(asyncResp, *automaticRetryConfig);
}
+
+ if (trustedModuleRequiredToBoot)
+ {
+ setTrustedModuleRequiredToBoot(
+ asyncResp, *trustedModuleRequiredToBoot);
+ }
}
if (locationIndicatorActive)
@@ -2866,12 +2872,6 @@
{
setPowerMode(asyncResp, *powerMode);
}
-
- if (trustedModuleRequiredToBoot)
- {
- setTrustedModuleRequiredToBoot(
- asyncResp, *trustedModuleRequiredToBoot);
- }
});
}