managers: use async_method_call() set PID properties
In sdbusplus::asio::setProperty(), the property value will be wrapped
by std:variant automaticly, it will fail and show `Invalid argument
[generic:22]` error if we pass the property value that has been wrapped
by std::variant into sdbusplus::asio::setProperty().
Because the type of property.second is DbusVariantType, we cannot use
sdbusplus::asio::setProperty() for property setting, so change it back
to use async_method_call().
Tested on Bletchley:
Success PATCH the properties of StepwiseControllers.
```
{
"Oem": {
"OpenBmc": {
"Fan": {
"StepwiseControllers": {
"Test1": {
"NegativeHysteresis": 7.0,
"PositiveHysteresis": 8.0
}
}
}
}
}
}
```
Signed-off-by: Potin Lai <potin.lai@quantatw.com>
Change-Id: I92d9e0d6ffe97fa6ce2905e17497d4d0fffa1d58
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index 314099b..38add8b 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -1591,10 +1591,7 @@
{
for (const auto& property : output)
{
- sdbusplus::asio::setProperty(
- *crow::connections::systemBus,
- "xyz.openbmc_project.EntityManager", path, iface,
- property.first, property.second,
+ crow::connections::systemBus->async_method_call(
[response,
propertyName{std::string(property.first)}](
const boost::system::error_code& ec) {
@@ -1606,7 +1603,10 @@
return;
}
messages::success(response->res);
- });
+ },
+ "xyz.openbmc_project.EntityManager", path,
+ "org.freedesktop.DBus.Properties", "Set", iface,
+ property.first, property.second);
}
}
else