]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/controllers/rgw.py
import 15.2.5
[ceph.git] / ceph / src / pybind / mgr / dashboard / controllers / rgw.py
index fc7d5190ed29d36951cf7a4d434436adcb443a54..a0dc444dcabff7d497f294c3ed1b9972352a8a8c 100644 (file)
@@ -5,7 +5,6 @@ import logging
 import json
 
 import cherrypy
-
 from . import ApiController, BaseController, RESTController, Endpoint, \
     ReadPermission
 from ..exceptions import DashboardException
@@ -18,7 +17,7 @@ from ..tools import json_str_to_object, str_to_bool
 
 try:
     from typing import List
-except ImportError:
+except ImportError:  # pragma: no cover
     pass  # Just for type checking
 
 logger = logging.getLogger('controllers.rgw')
@@ -33,7 +32,7 @@ class Rgw(BaseController):
         try:
             instance = RgwClient.admin_instance()
             # Check if the service is online.
-            if not instance.is_service_online():
+            if not instance.is_service_online():  # pragma: no cover - no complexity there
                 msg = 'Failed to connect to the Object Gateway\'s Admin Ops API.'
                 raise RequestException(msg)
             # Ensure the API user ID is known by the RGW.
@@ -42,7 +41,7 @@ class Rgw(BaseController):
                     instance.userid)
                 raise RequestException(msg)
             # Ensure the system flag is set for the API user ID.
-            if not instance.is_system_user():
+            if not instance.is_system_user():  # pragma: no cover - no complexity there
                 msg = 'The system flag is not set for user "{}".'.format(
                     instance.userid)
                 raise RequestException(msg)
@@ -229,7 +228,7 @@ class RgwBucket(RgwRESTController):
                                   lock_retention_period_days,
                                   lock_retention_period_years)
             return result
-        except RequestException as e:
+        except RequestException as e:  # pragma: no cover - handling is too obvious
             raise DashboardException(e, http_status_code=500, component='rgw')
 
     def set(self, bucket, bucket_id, uid, versioning_state=None,
@@ -380,7 +379,7 @@ class RgwUser(RgwRESTController):
                                              'Object Gateway'.format(uid))
             # Finally redirect request to the RGW proxy.
             return self.proxy('DELETE', 'user', {'uid': uid}, json_response=False)
-        except (DashboardException, RequestException) as e:
+        except (DashboardException, RequestException) as e:  # pragma: no cover
             raise DashboardException(e, component='rgw')
 
     # pylint: disable=redefined-builtin