Ejemplo n.º 1
0
class FortinetException(Exception):
    """Base Fortinet Exception

    To correctly use this class, inherit from it and define
    a 'msg_fmt' property. That msg_fmt will get printf'd
    with the keyword arguments provided to the constructor.

    """
    msg_fmt = _("An unknown exception occurred.")
    code = 500
    headers = {}
    safe = False

    def __init__(self, message=None, **kwargs):
        self.kwargs = kwargs

        if 'code' not in self.kwargs:
            try:
                self.kwargs['code'] = self.code
            except AttributeError:
                pass

        if not message:
            try:
                message = self.msg_fmt % kwargs

            except Exception:
                exc_info = sys.exc_info()
                # kwargs doesn't match a variable in the message
                # log the issue and the kwargs
                LOG.exception(_LE('Exception in string format operation'))
                for name, value in six.iteritems(kwargs):
                    LOG.error("%s: %s" % (name, value))

                if CONF.fatal_exception_format_errors:
                    six.reraise(*exc_info)
                else:
                    # at least get the core message out if something happened
                    message = self.msg_fmt

        self.message = message
        super(FortinetException, self).__init__(message)

    def format_message(self):
        return self.args[0]
Ejemplo n.º 2
0
class InstanceNotFound(NotFound):
    ec2_code = 'InvalidInstanceID.NotFound'
    msg_fmt = _("Instance %(instance_id)s could not be found.")
Ejemplo n.º 3
0
class VirtualInterfaceMacAddressException(FortinetException):
    msg_fmt = _("Creation of virtual interface with "
                "unique mac address failed")
Ejemplo n.º 4
0
class Invalid(FortinetException):
    msg_fmt = _("Unacceptable parameters.")
    code = 400
Ejemplo n.º 5
0
class ServiceUnavailable(Invalid):
    msg_fmt = _("Service is unavailable at this time.")
Ejemplo n.º 6
0
class MultiplePortsNotApplicable(Invalid):
    msg_fmt = _("Failed to launch instances: %(reason)s")
Ejemplo n.º 7
0
class InstanceTerminationFailure(Invalid):
    msg_fmt = _("Failed to terminate instance: %(reason)s")
Ejemplo n.º 8
0
class InstancePowerOffFailure(Invalid):
    msg_fmt = _("Failed to power off instance: %(reason)s")
Ejemplo n.º 9
0
class InvalidGroup(Invalid):
    msg_fmt = _("Group not valid. Reason: %(reason)s")
Ejemplo n.º 10
0
class InvalidAggregateActionUpdateMeta(InvalidAggregateAction):
    msg_fmt = _("Cannot update metadata of aggregate "
                "%(aggregate_id)s. Reason: %(reason)s.")
Ejemplo n.º 11
0
class InvalidAggregateActionDelete(InvalidAggregateAction):
    msg_fmt = _("Cannot remove host from aggregate "
                "%(aggregate_id)s. Reason: %(reason)s.")
Ejemplo n.º 12
0
class InvalidAggregateActionAdd(InvalidAggregateAction):
    msg_fmt = _("Cannot add host to aggregate "
                "%(aggregate_id)s. Reason: %(reason)s.")
Ejemplo n.º 13
0
class InvalidAggregateAction(Invalid):
    msg_fmt = _("Unacceptable parameters.")
    code = 400
Ejemplo n.º 14
0
class InvalidParameterValue(Invalid):
    ec2_code = 'InvalidParameterValue'
    msg_fmt = _("%(err)s")
Ejemplo n.º 15
0
class DeviceNotFound(NotFound):
    msg_fmt = _("Device '%(device)s' not found.")
Ejemplo n.º 16
0
class InstanceSuspendFailure(Invalid):
    msg_fmt = _("Failed to suspend instance: %(reason)s")
Ejemplo n.º 17
0
class InstanceResumeFailure(Invalid):
    msg_fmt = _("Failed to resume instance: %(reason)s")
Ejemplo n.º 18
0
class InvalidSortKey(Invalid):
    msg_fmt = _("Sort key supplied was not valid.")
Ejemplo n.º 19
0
class InstanceRebootFailure(Invalid):
    msg_fmt = _("Failed to reboot instance: %(reason)s")
Ejemplo n.º 20
0
class InvalidStrTime(Invalid):
    msg_fmt = _("Invalid datetime string: %(reason)s")
Ejemplo n.º 21
0
class InstanceDeployFailure(Invalid):
    msg_fmt = _("Failed to deploy instance: %(reason)s")
Ejemplo n.º 22
0
class InstanceInvalidState(Invalid):
    msg_fmt = _("Instance %(instance_uuid)s in %(attr)s %(state)s. Cannot "
                "%(method)s while the instance is in this state.")
Ejemplo n.º 23
0
class InvalidFixedIpAndMaxCountRequest(Invalid):
    msg_fmt = _("Failed to launch instances: %(reason)s")
Ejemplo n.º 24
0
class InstanceNotRunning(Invalid):
    msg_fmt = _("Instance %(instance_id)s is not running.")
Ejemplo n.º 25
0
class InstanceNotInRescueMode(Invalid):
    msg_fmt = _("Instance %(instance_id)s is not in rescue mode")
Ejemplo n.º 26
0
class InstanceNotRescuable(Invalid):
    msg_fmt = _("Instance %(instance_id)s cannot be rescued: %(reason)s")
Ejemplo n.º 27
0
class NotFound(FortinetException):
    msg_fmt = _("Resource could not be found.")
    code = 404
Ejemplo n.º 28
0
class InstanceNotReady(Invalid):
    msg_fmt = _("Instance %(instance_id)s is not ready")
Ejemplo n.º 29
0
class HypervisorUnavailable(FortinetException):
    msg_fmt = _("Connection to the hypervisor is broken on host: %(host)s")
Ejemplo n.º 30
0
class DeviceDetachFailed(FortinetException):
    msg_fmt = _("Device detach failed for %(device)s: %(reason)s)")