class OrchestratorException(Exception): """Base Orchestrator Exception. To correctly use this class, inherit from it and define a 'message' property. That message will get printf'd with the keyword arguments provided to the constructor. """ message = _("An unknown exception occurred.") def __init__(self, **kwargs): try: super(OrchestratorException, self).__init__(self.message % kwargs) self.msg = self.message % kwargs except Exception: with excutils.save_and_reraise_exception() as ctxt: if not self.use_fatal_exceptions(): ctxt.reraise = False # at least get the core message out if something happened super(OrchestratorException, self).__init__(self.message) if six.PY2: def __unicode__(self): return unicode(self.msg) def use_fatal_exceptions(self): return False
class NotAuthorized(OrchestratorException): message = _("Not authorized.")
class BadRequest(OrchestratorException): message = _('Bad %(resource)s request: %(msg)s')
class CommunityNotFound(NotFound): message = _("Community %(community)s not found in region=%(region_name)s")
class ResourceNotFound(NotFound): message = _("Resource not available")
class CommunityAlreadyExists(Conflict): message = _("Community %(community)s in region=%(region_name)s " "already exists")
class ObjectActionError(OrchestratorException): msg_fmt = _('Object action %(action)s failed because: %(reason)s')
class InUse(OrchestratorException): message = _("The resource is inuse")
class OrchRequestNotFound(NotFound): message = _("OrchRequest %(orch_request)s not found")
class OrchRequestAlreadyExists(Conflict): message = _("OrchRequest with orch_request=%(orch_request)s " "target_region_name=%(target_region_name)s already exists")
class OrchJobAlreadyExists(Conflict): message = _("OrchJob with resource_id=%(resource_id)s " "endpoint_type=%(endpoint_type)s " "operation_type=%(operation_type)s already exists")
class OrchJobNotFound(NotFound): message = _("OrchJob %(orch_job)s not found")
class SubcloudNotFound(NotFound): message = _("Subcloud %(region_name)s not found")
class ServiceUnavailable(OrchestratorException): message = _("The service is unavailable")
class TrapDestAlreadyExists(Conflict): message = _("TrapDest in region=%(region_name)s ip_address=%(ip_address)s " "community=%(community)s already exists")
class AdminRequired(NotAuthorized): message = _("User does not have admin privileges: %(reason)s")
class TrapDestNotFound(NotFound): message = _("Trapdest in region=%(region_name)s with ip_address " "%(ip_address)s not found")
class InvalidConfigurationOption(OrchestratorException): message = _("An invalid value was provided for %(opt_name)s: " "%(opt_value)s")
class SyncRequestTimeout(OrchestratorException): message = _("The sync operation timed out")