Remove InvalidUpload response code
Invalid response is something from the openbmc registry, so it's not
a valid thing to return as a response code. For this patch, remove
the generated error message, and replace the one place it's used with
internalError.
Tested: On last patch in series.
Change-Id: I8215935f00923c72fd7763645c06d0b6af73c01d
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 7c2c5f4..ad6bafe 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -336,52 +336,44 @@
inline void
handleUpdateErrorType(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& url, const std::string& type)
+ const std::string& /*url*/, const std::string& type)
{
+ // NOLINTBEGIN(bugprone-branch-clone)
if (type == "xyz.openbmc_project.Software.Image.Error.UnTarFailure")
{
- redfish::messages::invalidUpload(asyncResp->res, url,
- "Invalid archive");
+ messages::internalError(asyncResp->res);
}
else if (type ==
"xyz.openbmc_project.Software.Image.Error.ManifestFileFailure")
{
- redfish::messages::invalidUpload(asyncResp->res, url,
- "Invalid manifest");
+ messages::internalError(asyncResp->res);
}
else if (type == "xyz.openbmc_project.Software.Image.Error.ImageFailure")
{
- redfish::messages::invalidUpload(asyncResp->res, url,
- "Invalid image format");
+ messages::internalError(asyncResp->res);
}
else if (type == "xyz.openbmc_project.Software.Version.Error.AlreadyExists")
{
- redfish::messages::invalidUpload(asyncResp->res, url,
- "Image version already exists");
-
- redfish::messages::resourceAlreadyExists(
- asyncResp->res, "UpdateService", "Version", "uploaded version");
+ messages::resourceAlreadyExists(asyncResp->res, "UpdateService",
+ "Version", "uploaded version");
}
else if (type == "xyz.openbmc_project.Software.Image.Error.BusyFailure")
{
- redfish::messages::resourceExhaustion(asyncResp->res, url);
+ messages::internalError(asyncResp->res);
}
else if (type == "xyz.openbmc_project.Software.Version.Error.Incompatible")
{
- redfish::messages::invalidUpload(asyncResp->res, url,
- "Incompatible image version");
+ messages::internalError(asyncResp->res);
}
else if (type ==
"xyz.openbmc_project.Software.Version.Error.ExpiredAccessKey")
{
- redfish::messages::invalidUpload(asyncResp->res, url,
- "Update Access Key Expired");
+ messages::internalError(asyncResp->res);
}
else if (type ==
"xyz.openbmc_project.Software.Version.Error.InvalidSignature")
{
- redfish::messages::invalidUpload(asyncResp->res, url,
- "Invalid image signature");
+ messages::internalError(asyncResp->res);
}
else if (type ==
"xyz.openbmc_project.Software.Image.Error.InternalFailure" ||
@@ -396,6 +388,7 @@
BMCWEB_LOG_INFO("Non-Software-related Error type={}. Ignored", type);
return;
}
+ // NOLINTEND(bugprone-branch-clone)
// Clear the timer
fwAvailableTimer = nullptr;
}