Update content of ResourceNotFound/ResourceAlreadyExists message
According to Redfish Base Message Registry definition [1], the first
argument of ResourceNotFound and ResourceAlreadyExists is the schema
name of the resource. This patch changes the first argument to non-
versioned schema name treewide.
Tested:
Verified the error message matches the definition, and Redfish Service
Validator passed.
[1] https://redfish.dmtf.org/registries/Base.1.13.0.json
Change-Id: Ib5cd853578ef0bffda1184d10827241e94faaf68
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
diff --git a/include/google/google_service_root.hpp b/include/google/google_service_root.hpp
index 2100fab..fddd7b6 100644
--- a/include/google/google_service_root.hpp
+++ b/include/google/google_service_root.hpp
@@ -85,8 +85,7 @@
}
// Couldn't find an object with that name. return an error
- redfish::messages::resourceNotFound(
- asyncResp->res, "#RootOfTrust.v1_0_0.RootOfTrust", rotId);
+ redfish::messages::resourceNotFound(asyncResp->res, "RootOfTrust", rotId);
}
inline void resolveRoT(const std::string& command,
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index d7c70c1..b6316ef 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -123,15 +123,13 @@
if (strcmp(errorMessage,
"xyz.openbmc_project.User.Common.Error.UserNameExists") == 0)
{
- messages::resourceAlreadyExists(asyncResp->res,
- "#ManagerAccount.v1_4_0.ManagerAccount",
+ messages::resourceAlreadyExists(asyncResp->res, "ManagerAccount",
"UserName", newUser);
}
else if (strcmp(errorMessage, "xyz.openbmc_project.User.Common.Error."
"UserNameDoesNotExist") == 0)
{
- messages::resourceNotFound(
- asyncResp->res, "#ManagerAccount.v1_4_0.ManagerAccount", username);
+ messages::resourceNotFound(asyncResp->res, "ManagerAccount", username);
}
else if ((strcmp(errorMessage,
"xyz.openbmc_project.Common.Error.InvalidArgument") ==
@@ -1123,8 +1121,7 @@
asyncResp{std::move(asyncResp)}](int rc) {
if (rc <= 0)
{
- messages::resourceNotFound(asyncResp->res,
- "#ManagerAccount.v1_4_0.ManagerAccount",
+ messages::resourceNotFound(asyncResp->res, "ManagerAccount",
username);
return;
}
@@ -1135,9 +1132,8 @@
if (retval == PAM_USER_UNKNOWN)
{
- messages::resourceNotFound(
- asyncResp->res, "#ManagerAccount.v1_4_0.ManagerAccount",
- username);
+ messages::resourceNotFound(asyncResp->res, "ManagerAccount",
+ username);
}
else if (retval == PAM_AUTHTOK_ERR)
{
@@ -1674,8 +1670,7 @@
handleAccountHead(app, req, asyncResp, accountName);
#ifdef BMCWEB_INSECURE_DISABLE_AUTHENTICATION
// If authentication is disabled, there are no user accounts
- messages::resourceNotFound(
- asyncResp->res, "#ManagerAccount.v1_4_0.ManagerAccount", accountName);
+ messages::resourceNotFound(asyncResp->res, "ManagerAccount", accountName);
return;
#endif // BMCWEB_INSECURE_DISABLE_AUTHENTICATION
@@ -1833,8 +1828,7 @@
#ifdef BMCWEB_INSECURE_DISABLE_AUTHENTICATION
// If authentication is disabled, there are no user accounts
- messages::resourceNotFound(
- asyncResp->res, "#ManagerAccount.v1_4_0.ManagerAccount", username);
+ messages::resourceNotFound(asyncResp->res, "ManagerAccount", username);
return;
#endif // BMCWEB_INSECURE_DISABLE_AUTHENTICATION
@@ -1846,8 +1840,7 @@
[asyncResp, username](const boost::system::error_code ec) {
if (ec)
{
- messages::resourceNotFound(asyncResp->res,
- "#ManagerAccount.v1_4_0.ManagerAccount",
+ messages::resourceNotFound(asyncResp->res, "ManagerAccount",
username);
return;
}
@@ -1869,8 +1862,7 @@
}
#ifdef BMCWEB_INSECURE_DISABLE_AUTHENTICATION
// If authentication is disabled, there are no user accounts
- messages::resourceNotFound(
- asyncResp->res, "#ManagerAccount.v1_4_0.ManagerAccount", username);
+ messages::resourceNotFound(asyncResp->res, "ManagerAccount", username);
return;
#endif // BMCWEB_INSECURE_DISABLE_AUTHENTICATION
diff --git a/redfish-core/lib/cable.hpp b/redfish-core/lib/cable.hpp
index 7389b4c..e553682 100644
--- a/redfish-core/lib/cable.hpp
+++ b/redfish-core/lib/cable.hpp
@@ -117,8 +117,7 @@
const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec.value() == EBADR)
{
- messages::resourceNotFound(asyncResp->res,
- "#Cable.v1_0_0.Cable", cableId);
+ messages::resourceNotFound(asyncResp->res, "Cable", cableId);
return;
}
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index c2a3dd6..ebd9436 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -634,7 +634,7 @@
if (ec)
{
BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
- messages::resourceNotFound(asyncResp->res, name, certId);
+ messages::resourceNotFound(asyncResp->res, "Certificate", certId);
return;
}
@@ -818,7 +818,8 @@
if (ec.value() ==
boost::system::linux_error::bad_request_descriptor)
{
- messages::resourceNotFound(asyncResp->res, name, id);
+ messages::resourceNotFound(asyncResp->res, "Certificate",
+ id);
return;
}
messages::internalError(asyncResp->res);
@@ -1203,8 +1204,7 @@
[asyncResp, id](const boost::system::error_code ec) {
if (ec)
{
- messages::resourceNotFound(asyncResp->res,
- "TrustStore Certificate", id);
+ messages::resourceNotFound(asyncResp->res, "Certificate", id);
return;
}
BMCWEB_LOG_INFO << "Certificate deleted";
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index 11ef6c4..c51b150 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -442,8 +442,7 @@
}
// Couldn't find an object with that name. return an error
- messages::resourceNotFound(asyncResp->res, "#Chassis.v1_16_0.Chassis",
- chassisId);
+ messages::resourceNotFound(asyncResp->res, "Chassis", chassisId);
},
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
@@ -570,8 +569,7 @@
return;
}
- messages::resourceNotFound(asyncResp->res, "#Chassis.v1_14_0.Chassis",
- chassisId);
+ messages::resourceNotFound(asyncResp->res, "Chassis", chassisId);
},
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 3428845..9c985d9 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -1918,7 +1918,7 @@
// ... otherwise return error
// TODO(Pawel)consider distinguish between non
// existing object, and other errors
- messages::resourceNotFound(asyncResp->res, "Ethernet Interface",
+ messages::resourceNotFound(asyncResp->res, "EthernetInterface",
ifaceId);
return;
}
@@ -2029,7 +2029,7 @@
// TODO(Pawel)consider distinguish between non
// existing object, and other errors
messages::resourceNotFound(asyncResp->res,
- "VLAN Network Interface", ifaceId);
+ "VLanNetworkInterface", ifaceId);
}
});
});
@@ -2048,7 +2048,7 @@
}
if (!verifyNames(parentIfaceId, ifaceId))
{
- messages::resourceNotFound(asyncResp->res, "VLAN Network Interface",
+ messages::resourceNotFound(asyncResp->res, "VLanNetworkInterface",
ifaceId);
return;
}
@@ -2102,7 +2102,7 @@
// TODO(Pawel)consider distinguish between non
// existing object, and other errors
messages::resourceNotFound(asyncResp->res,
- "VLAN Network Interface", ifaceId);
+ "VLanNetworkInterface", ifaceId);
return;
}
});
@@ -2122,7 +2122,7 @@
}
if (!verifyNames(parentIfaceId, ifaceId))
{
- messages::resourceNotFound(asyncResp->res, "VLAN Network Interface",
+ messages::resourceNotFound(asyncResp->res, "VLanNetworkInterface",
ifaceId);
return;
}
@@ -2155,7 +2155,7 @@
// TODO(Pawel)consider distinguish between non
// existing object, and other errors
messages::resourceNotFound(asyncResp->res,
- "VLAN Network Interface", ifaceId);
+ "VLanNetworkInterface", ifaceId);
}
});
});
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index c3b659e..0d6be71 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -572,8 +572,7 @@
{
// Dump status is not Complete
// return not found until status is changed to Completed
- messages::resourceNotFound(asyncResp->res, dumpType + " dump",
- entryID);
+ messages::resourceNotFound(asyncResp->res, "LogEntry", entryID);
return;
}
@@ -1490,8 +1489,7 @@
const dbus::utility::DBusPropertiesMap& resp) {
if (ec.value() == EBADR)
{
- messages::resourceNotFound(asyncResp->res, "EventLogEntry",
- entryID);
+ messages::resourceNotFound(asyncResp->res, "LogEntry", entryID);
return;
}
if (ec)
diff --git a/redfish-core/lib/message_registries.hpp b/redfish-core/lib/message_registries.hpp
index 189cd2e..09d32b7 100644
--- a/redfish-core/lib/message_registries.hpp
+++ b/redfish-core/lib/message_registries.hpp
@@ -99,9 +99,8 @@
}
else
{
- messages::resourceNotFound(
- asyncResp->res, "#MessageRegistryFile.v1_1_0.MessageRegistryFile",
- registry);
+ messages::resourceNotFound(asyncResp->res, "MessageRegistryFile",
+ registry);
return;
}
@@ -185,9 +184,8 @@
}
else
{
- messages::resourceNotFound(
- asyncResp->res, "#MessageRegistryFile.v1_1_0.MessageRegistryFile",
- registry);
+ messages::resourceNotFound(asyncResp->res, "MessageRegistryFile",
+ registry);
return;
}
diff --git a/redfish-core/lib/pcie_slots.hpp b/redfish-core/lib/pcie_slots.hpp
index 0cc570c..cff1e27 100644
--- a/redfish-core/lib/pcie_slots.hpp
+++ b/redfish-core/lib/pcie_slots.hpp
@@ -214,7 +214,7 @@
}
if (subtree.empty())
{
- messages::resourceNotFound(asyncResp->res, "#Chassis", chassisID);
+ messages::resourceNotFound(asyncResp->res, "Chassis", chassisID);
return;
}
diff --git a/redfish-core/lib/redfish_v1.hpp b/redfish-core/lib/redfish_v1.hpp
index 8907709..c7c5265 100644
--- a/redfish-core/lib/redfish_v1.hpp
+++ b/redfish-core/lib/redfish_v1.hpp
@@ -107,8 +107,7 @@
if (std::find(schemas.begin(), schemas.end(), schema) == schemas.end())
{
- messages::resourceNotFound(asyncResp->res,
- "JsonSchemaFile.JsonSchemaFile", schema);
+ messages::resourceNotFound(asyncResp->res, "JsonSchemaFile", schema);
return;
}
diff --git a/redfish-core/lib/task.hpp b/redfish-core/lib/task.hpp
index 08573d5..b40d522 100644
--- a/redfish-core/lib/task.hpp
+++ b/redfish-core/lib/task.hpp
@@ -342,14 +342,14 @@
if (find == task::tasks.end())
{
- messages::resourceNotFound(asyncResp->res, "Monitor", strParam);
+ messages::resourceNotFound(asyncResp->res, "Task", strParam);
return;
}
std::shared_ptr<task::TaskData>& ptr = *find;
// monitor expires after 204
if (ptr->gave204)
{
- messages::resourceNotFound(asyncResp->res, "Monitor", strParam);
+ messages::resourceNotFound(asyncResp->res, "Task", strParam);
return;
}
ptr->populateResp(asyncResp->res);
@@ -383,7 +383,7 @@
if (find == task::tasks.end())
{
- messages::resourceNotFound(asyncResp->res, "Tasks", strParam);
+ messages::resourceNotFound(asyncResp->res, "Task", strParam);
return;
}
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index 6cf15d6..fd4f53f 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -369,8 +369,7 @@
"Image version already exists");
redfish::messages::resourceAlreadyExists(
- asyncResp->res,
- "UpdateService.v1_5_0.UpdateService", "Version",
+ asyncResp->res, "UpdateService", "Version",
"uploaded version");
}
else if (
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
index 17971dc..15dcdb9 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
@@ -270,8 +270,7 @@
return;
}
- messages::resourceNotFound(
- aResp->res, "#VirtualMedia.v1_3_0.VirtualMedia", resName);
+ messages::resourceNotFound(aResp->res, "VirtualMedia", resName);
},
service, "/xyz/openbmc_project/VirtualMedia",
"org.freedesktop.DBus.ObjectManager", "GetManagedObjects");