blob: 6ad7cf174049612eed7d4159e06f60286ed2c56e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
From 1d69a22d0ec1eddbe6d703d6824f413f6b68399e Mon Sep 17 00:00:00 2001
From: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
Date: Thu, 1 Jul 2021 10:41:47 +0000
Subject: [PATCH] Bmcweb handle permission denied exception
Add handling of permission denied exception (EPERM) that
can be thrown by VirtualMedia service during Mount/Unmount dbus operations.
Tested:
Verified that after mounting/unmounting HTTPS resource twice in a row in legacy mode,
VirtualMedia returns EPERM, which bmcweb handles as 403 status code.
Change-Id: Ibc18d5ec822c5072605b1fc4651389982002798b
Signed-off-by: Alicja Rybak <alicja.rybak@intel.com>
---
redfish-core/lib/virtual_media.hpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
index 186c04b..8e7c2e4 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
@@ -917,6 +917,11 @@ inline void doVmAction(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
{
messages::resourceInUse(asyncResp->res);
}
+ else if (ec == boost::system::errc::permission_denied)
+ {
+ messages::accessDenied(asyncResp->res,
+ "VirtualMedia.Insert");
+ }
else
{
messages::internalError(asyncResp->res);
--
2.25.1
|