chassis: Remove boost::ends_with method
The boost::ends_with method should be replaced with
sdbusplus::message::object_path.
Tested:
curl -k https://$bmc/redfish/v1/Chassis/chassis
{
"@odata.id": "/redfish/v1/Chassis/chassis",
"@odata.type": "#Chassis.v1_14_0.Chassis",
"Actions": {
"#Chassis.Reset": {
"@Redfish.ActionInfo": "/redfish/v1/Chassis/chassis/ResetActionInfo",
"target": "/redfish/v1/Chassis/chassis/Actions/Chassis.Reset"
}
},
"ChassisType": "RackMount",
"Id": "chassis",
"Links": {
"ComputerSystems": [
{
"@odata.id": "/redfish/v1/Systems/system"
}
],
"ManagedBy": [
{
"@odata.id": "/redfish/v1/Managers/bmc"
}
]
},
"Manufacturer": "",
"Model": "23",
"Name": "chassis",
"PCIeDevices": {
"@odata.id": "/redfish/v1/Systems/system/PCIeDevices"
},
"PartNumber": "",
"Power": {
"@odata.id": "/redfish/v1/Chassis/chassis/Power"
},
"PowerState": "Off",
"Sensors": {
"@odata.id": "/redfish/v1/Chassis/chassis/Sensors"
},
"SerialNumber": "",
"Status": {
"Health": "OK",
"HealthRollup": "OK",
"State": "StandbyOffline"
},
"Thermal": {
"@odata.id": "/redfish/v1/Chassis/chassis/Thermal"
}
}
curl -k https://$bmc/redfish/v1/Chassis/chassis15363
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The requested resource of type #Chassis.v1_14_0.Chassis named chassis15363 was not found.",
"MessageArgs": [
"#Chassis.v1_14_0.Chassis",
"chassis15363"
],
"MessageId": "Base.1.8.1.ResourceNotFound",
"MessageSeverity": "Critical",
"Resolution": "Provide a valid resource identifier and resubmit the request."
}
],
"code": "Base.1.8.1.ResourceNotFound",
"message": "The requested resource of type #Chassis.v1_14_0.Chassis named chassis15363 was not found."
}
}
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Ieb9e9b02f1d66529e237815610365c33d7d8a079
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index c625b4b..745f5af 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -276,7 +276,8 @@
std::pair<std::string, std::vector<std::string>>>&
connectionNames = object.second;
- if (!boost::ends_with(path, chassisId))
+ sdbusplus::message::object_path objPath(path);
+ if (objPath.filename() != chassisId)
{
continue;
}
@@ -544,7 +545,8 @@
std::pair<std::string, std::vector<std::string>>>&
connectionNames = object.second;
- if (!boost::ends_with(path, chassisId))
+ sdbusplus::message::object_path objPath(path);
+ if (objPath.filename() != chassisId)
{
continue;
}