Put simple update behind an option
4e338b2313f9f2a91aa1fb36693e36a328d58933 Removed tftp update support
from the codebase, but left SimpleUpdate in a non functional state.
Given that a number of forks have implemented the HTTPS/SCP versions of
simple update, we don't want to fully delete the code at this time, so
for the moment put it behind an option flag.
Tested: WIP
Change-Id: Ibab1e3a48ff640787eabf8ed5f7a5c08e3381307
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index 74c6f92..243b9ad 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -497,12 +497,8 @@
res, imageURI, "ImageURI", "UpdateService.SimpleUpdate");
return std::nullopt;
}
- // OpenBMC currently only supports TFTP or HTTPS
- if (*transferProtocol == "TFTP")
- {
- imageURI = "tftp://" + imageURI;
- }
- else if (*transferProtocol == "HTTPS")
+ // OpenBMC currently only supports HTTPS
+ if (*transferProtocol == "HTTPS")
{
imageURI = "https://" + imageURI;
}
@@ -1105,22 +1101,19 @@
asyncResp->res.jsonValue["MaxImageSizeBytes"] =
BMCWEB_HTTP_BODY_LIMIT * 1024 * 1024;
- // Update Actions object.
- nlohmann::json& updateSvcSimpleUpdate =
- asyncResp->res.jsonValue["Actions"]["#UpdateService.SimpleUpdate"];
- updateSvcSimpleUpdate["target"] =
- "/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate";
-
- nlohmann::json::array_t allowed;
- allowed.emplace_back(update_service::TransferProtocolType::HTTPS);
-
- if constexpr (BMCWEB_INSECURE_PUSH_STYLE_NOTIFICATION)
+ if constexpr (BMCWEB_REDFISH_ALLOW_SIMPLE_UPDATE)
{
- allowed.emplace_back(update_service::TransferProtocolType::TFTP);
- }
+ // Update Actions object.
+ nlohmann::json& updateSvcSimpleUpdate =
+ asyncResp->res.jsonValue["Actions"]["#UpdateService.SimpleUpdate"];
+ updateSvcSimpleUpdate["target"] =
+ "/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate";
- updateSvcSimpleUpdate["TransferProtocol@Redfish.AllowableValues"] =
- std::move(allowed);
+ nlohmann::json::array_t allowed;
+ allowed.emplace_back(update_service::TransferProtocolType::HTTPS);
+ updateSvcSimpleUpdate["TransferProtocol@Redfish.AllowableValues"] =
+ std::move(allowed);
+ }
asyncResp->res
.jsonValue["HttpPushUriOptions"]["HttpPushUriApplyTime"]["ApplyTime"] =
@@ -1324,12 +1317,15 @@
inline void requestRoutesUpdateService(App& app)
{
- BMCWEB_ROUTE(
- app, "/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate/")
- .privileges(redfish::privileges::postUpdateService)
- .methods(boost::beast::http::verb::post)(std::bind_front(
- handleUpdateServiceSimpleUpdateAction, std::ref(app)));
-
+ if constexpr (BMCWEB_REDFISH_ALLOW_SIMPLE_UPDATE)
+ {
+ BMCWEB_ROUTE(
+ app,
+ "/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate/")
+ .privileges(redfish::privileges::postUpdateService)
+ .methods(boost::beast::http::verb::post)(std::bind_front(
+ handleUpdateServiceSimpleUpdateAction, std::ref(app)));
+ }
BMCWEB_ROUTE(app, "/redfish/v1/UpdateService/FirmwareInventory/<str>/")
.privileges(redfish::privileges::getSoftwareInventory)
.methods(boost::beast::http::verb::get)(std::bind_front(