IndicatorLED: Add compile option for deprecated property
The IndicatorLED property has been deprecated by Redfish since September
2020. The Redfish Service Validator reports a WARNING for this property:
```
WARNING - IndicatorLED: The given property is deprecated: This property has been deprecated in favor of the `LocationIndicatorActive` property.
```
The LocationIndicatorActive property is now implemented in bmcweb in
all places where IndicatorLED was implemented. So a new meson option
(redfish-allow-deprecated-indicatorled) is being added to control
whether this property is part of get or patch requests. The option is
disabled by default with plans to remove the option by March 2026.
Tested:
- Built with option enabled and confirmed IndicatorLED still part of
Redfish responses and can be patched.
- Built with option disabled and confirmed Redfish Service Validator no
longer reports the warning.
- Built with option disabled and confirmed IndicatorLED no longer part
of Redfish responses and patch fails appropriately.
```
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X PATCH -d '{"IndicatorLED":"Blinking"}' https://${bmc}/redfish/v1/Systems/system
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The property IndicatorLED is not in the list of valid properties for the resource.",
"MessageArgs": [
"IndicatorLED"
],
"MessageId": "Base.1.19.PropertyUnknown",
"MessageSeverity": "Warning",
"Resolution": "Remove the unknown property from the request body and resubmit the request if the operation failed."
}
],
"code": "Base.1.19.PropertyUnknown",
"message": "The property IndicatorLED is not in the list of valid properties for the resource."
}
}
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X PATCH -d '{"IndicatorLED":"Off"}' https://${bmc}/redfish/v1/Chassis/chassis
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The property IndicatorLED is not in the list of valid properties for the resource.",
"MessageArgs": [
"IndicatorLED"
],
"MessageId": "Base.1.19.PropertyUnknown",
"MessageSeverity": "Warning",
"Resolution": "Remove the unknown property from the request body and resubmit the request if the operation failed."
}
],
"code": "Base.1.19.PropertyUnknown",
"message": "The property IndicatorLED is not in the list of valid properties for the resource."
}
}
```
Change-Id: I2c0d415a7a54aa3122b18d2a1aa69bd9259d567e
Signed-off-by: Janet Adkins <janeta@us.ibm.com>
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index e006b9a..31cf897 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -3124,8 +3124,11 @@
}
});
- // TODO (Gunnar): Remove IndicatorLED after enough time has passed
- getIndicatorLedState(asyncResp);
+ if constexpr (BMCWEB_REDFISH_ALLOW_DEPRECATED_INDICATORLED)
+ {
+ getIndicatorLedState(asyncResp);
+ }
+
getComputerSystem(asyncResp);
getHostState(asyncResp);
getBootProperties(asyncResp);
@@ -3220,6 +3223,15 @@
return;
}
+ if constexpr (!BMCWEB_REDFISH_ALLOW_DEPRECATED_INDICATORLED)
+ {
+ if (indicatorLed)
+ {
+ messages::propertyUnknown(asyncResp->res, "IndicatorLED");
+ return;
+ }
+ }
+
if (assetTag)
{
setAssetTag(asyncResp, *assetTag);
@@ -3273,14 +3285,15 @@
});
}
- // TODO (Gunnar): Remove IndicatorLED after enough time has
- // passed
- if (indicatorLed)
+ if constexpr (BMCWEB_REDFISH_ALLOW_DEPRECATED_INDICATORLED)
{
- setIndicatorLedState(asyncResp, *indicatorLed);
- asyncResp->res.addHeader(boost::beast::http::field::warning,
- "299 - \"IndicatorLED is deprecated. Use "
- "LocationIndicatorActive instead.\"");
+ if (indicatorLed)
+ {
+ setIndicatorLedState(asyncResp, *indicatorLed);
+ asyncResp->res.addHeader(boost::beast::http::field::warning,
+ "299 - \"IndicatorLED is deprecated. Use "
+ "LocationIndicatorActive instead.\"");
+ }
}
if (powerRestorePolicy)