Fix comparison for proxy/legacy mode
After sdbusplus made available string path wrapper VM code has been
updated to use it. This makes legacy mode unusable as appropriate
change introduced a problem with comparison of DBus object path, which
is now fixed.
Tested:
After applying this fix, legacy mode has InsertMedia action enabled
again.
Change-Id: I6339ae2977faacf50ce708199aaf3b13b4314398
Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
index 9667c71..685ee5c 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
@@ -253,10 +253,24 @@
continue;
}
+ // "Legacy"/"Proxy"
+ auto mode = item.first.parent_path();
+ // "VirtualMedia"
+ auto type = mode.parent_path();
+ if (mode.filename().empty() || type.filename().empty())
+ {
+ continue;
+ }
+
+ if (type.filename() != "VirtualMedia")
+ {
+ continue;
+ }
+
aResp->res.jsonValue = vmItemTemplate(name, resName);
// Check if dbus path is Legacy type
- if (thispath.find("VirtualMedia/Legacy") != std::string::npos)
+ if (mode.filename() == "Legacy")
{
aResp->res.jsonValue["Actions"]["#VirtualMedia.InsertMedia"]
["target"] =