import json
import cherrypy
-
from . import ApiController, BaseController, RESTController, Endpoint, \
ReadPermission
from ..exceptions import DashboardException
try:
from typing import List
-except ImportError:
+except ImportError: # pragma: no cover
pass # Just for type checking
logger = logging.getLogger('controllers.rgw')
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.
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)
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,
'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