How to use the gnocchi.indexer.__init__.IndexerException function in gnocchi

To help you get started, we’ve selected a few gnocchi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gnocchixyz / gnocchi / gnocchi / indexer / __init__.py View on Github external
"""Error raised when an archive policy already exists."""
    def __init__(self, name):
        super(ArchivePolicyAlreadyExists, self).__init__(
            "Archive policy %s already exists" % name)
        self.name = name


class ArchivePolicyRuleAlreadyExists(IndexerException):
    """Error raised when an archive policy rule already exists."""
    def __init__(self, name):
        super(ArchivePolicyRuleAlreadyExists, self).__init__(
            "Archive policy rule %s already exists" % name)
        self.name = name


class QueryError(IndexerException):
    def __init__(self):
        super(QueryError, self).__init__("Unable to parse this query")


class QueryValueError(QueryError, ValueError):
    def __init__(self, v, f):
        super(QueryError, self).__init__("Invalid value: `%s' for field `%s'"
                                         % (v, f))


class QueryInvalidOperator(QueryError):
    def __init__(self, op):
        self.op = op
        super(QueryError, self).__init__("Unknown operator `%s'" % op)
github gnocchixyz / gnocchi / gnocchi / indexer / __init__.py View on Github external
self.resource = resource

    def jsonify(self):
        return {"cause": "Resource already exists",
                "detail": self.resource}


class ResourceTypeAlreadyExists(IndexerException):
    """Error raised when a resource type already exists."""
    def __init__(self, resource_type):
        super(ResourceTypeAlreadyExists, self).__init__(
            "Resource type %s already exists" % resource_type)
        self.resource_type = resource_type


class ResourceAttributeError(IndexerException, AttributeError):
    """Error raised when an attribute does not exist for a resource type."""
    def __init__(self, resource, attribute):
        super(ResourceAttributeError, self).__init__(
            "Resource type %s has no %s attribute" % (resource, attribute))
        self.resource = resource
        self.attribute = attribute


class ResourceValueError(IndexerException, ValueError):
    """Error raised when an attribute value is invalid for a resource type."""
    def __init__(self, resource_type, attribute, value):
        super(ResourceValueError, self).__init__(
            "Value %s for attribute %s on resource type %s is invalid"
            % (value, attribute, resource_type))
        self.resource_type = resource_type
        self.attribute = attribute
github gnocchixyz / gnocchi / gnocchi / indexer / __init__.py View on Github external
"No Archive policy rule found for metric %s" %
            metric_name)
        self.metric_name = metric_name


class UnsupportedArchivePolicyRuleChange(IndexerException):
    """Error raised when modifying archive policy rule if not supported."""
    def __init__(self, archive_policy_rule, message):
        super(UnsupportedArchivePolicyRuleChange, self).__init__(
            "Archive policy rule %s does not support change: %s" %
            (archive_policy_rule, message))
        self.archive_policy_rule = archive_policy_rule
        self.message = message


class NamedMetricAlreadyExists(IndexerException):
    """Error raised when a named metric already exists."""
    def __init__(self, metric_name):
        super(NamedMetricAlreadyExists, self).__init__(
            "Named metric %s already exists" % metric_name)
        self.metric_name = metric_name

    def jsonify(self):
        return {"cause": "Named metric already exists",
                "detail": self.metric_name}


class ResourceAlreadyExists(IndexerException):
    """Error raised when a resource already exists."""
    def __init__(self, resource):
        super(ResourceAlreadyExists, self).__init__(
            "Resource %s already exists" % resource)
github gnocchixyz / gnocchi / gnocchi / indexer / __init__.py View on Github external
"detail": self.metric_name}


class ResourceAlreadyExists(IndexerException):
    """Error raised when a resource already exists."""
    def __init__(self, resource):
        super(ResourceAlreadyExists, self).__init__(
            "Resource %s already exists" % resource)
        self.resource = resource

    def jsonify(self):
        return {"cause": "Resource already exists",
                "detail": self.resource}


class ResourceTypeAlreadyExists(IndexerException):
    """Error raised when a resource type already exists."""
    def __init__(self, resource_type):
        super(ResourceTypeAlreadyExists, self).__init__(
            "Resource type %s already exists" % resource_type)
        self.resource_type = resource_type


class ResourceAttributeError(IndexerException, AttributeError):
    """Error raised when an attribute does not exist for a resource type."""
    def __init__(self, resource, attribute):
        super(ResourceAttributeError, self).__init__(
            "Resource type %s has no %s attribute" % (resource, attribute))
        self.resource = resource
        self.attribute = attribute
github gnocchixyz / gnocchi / gnocchi / indexer / __init__.py View on Github external
resource_type, state, expected_state))
        self.resource_type = resource_type
        self.expected_state = expected_state
        self.state = state


class NoSuchArchivePolicyRule(IndexerException):
    """Error raised when an archive policy rule does not exist."""
    def __init__(self, archive_policy_rule):
        super(NoSuchArchivePolicyRule, self).__init__(
            "Archive policy rule %s does not exist" %
            archive_policy_rule)
        self.archive_policy_rule = archive_policy_rule


class NoArchivePolicyRuleMatch(IndexerException):
    """Error raised when no archive policy rule found for metric."""
    def __init__(self, metric_name):
        super(NoArchivePolicyRuleMatch, self).__init__(
            "No Archive policy rule found for metric %s" %
            metric_name)
        self.metric_name = metric_name


class UnsupportedArchivePolicyRuleChange(IndexerException):
    """Error raised when modifying archive policy rule if not supported."""
    def __init__(self, archive_policy_rule, message):
        super(UnsupportedArchivePolicyRuleChange, self).__init__(
            "Archive policy rule %s does not support change: %s" %
            (archive_policy_rule, message))
        self.archive_policy_rule = archive_policy_rule
        self.message = message
github gnocchixyz / gnocchi / gnocchi / indexer / __init__.py View on Github external
def jsonify(self):
        return {
            "cause": "Resource type does not exist",
            "detail": self.type,
        }


class NoSuchMetric(IndexerException):
    """Error raised when a metric does not exist."""
    def __init__(self, metric):
        super(NoSuchMetric, self).__init__("Metric %s does not exist" %
                                           metric)
        self.metric = metric


class NoSuchResource(IndexerException):
    """Error raised when a resource does not exist."""
    def __init__(self, resource):
        super(NoSuchResource, self).__init__("Resource %s does not exist" %
                                             resource)
        self.resource = resource


class NoSuchArchivePolicy(IndexerException):
    """Error raised when an archive policy does not exist."""
    def __init__(self, archive_policy):
        super(NoSuchArchivePolicy, self).__init__(
            "Archive policy %s does not exist" % archive_policy)
        self.archive_policy = archive_policy

    def jsonify(self):
        return {
github gnocchixyz / gnocchi / gnocchi / indexer / __init__.py View on Github external
"Value %s for attribute %s on resource type %s is invalid"
            % (value, attribute, resource_type))
        self.resource_type = resource_type
        self.attribute = attribute
        self.value = value


class ArchivePolicyAlreadyExists(IndexerException):
    """Error raised when an archive policy already exists."""
    def __init__(self, name):
        super(ArchivePolicyAlreadyExists, self).__init__(
            "Archive policy %s already exists" % name)
        self.name = name


class ArchivePolicyRuleAlreadyExists(IndexerException):
    """Error raised when an archive policy rule already exists."""
    def __init__(self, name):
        super(ArchivePolicyRuleAlreadyExists, self).__init__(
            "Archive policy rule %s already exists" % name)
        self.name = name


class QueryError(IndexerException):
    def __init__(self):
        super(QueryError, self).__init__("Unable to parse this query")


class QueryValueError(QueryError, ValueError):
    def __init__(self, v, f):
        super(QueryError, self).__init__("Invalid value: `%s' for field `%s'"
                                         % (v, f))
github gnocchixyz / gnocchi / gnocchi / indexer / __init__.py View on Github external
class NoSuchResourceType(IndexerException):
    """Error raised when the resource type is unknown."""
    def __init__(self, type):
        super(NoSuchResourceType, self).__init__(
            "Resource type %s does not exist" % type)
        self.type = type

    def jsonify(self):
        return {
            "cause": "Resource type does not exist",
            "detail": self.type,
        }


class NoSuchMetric(IndexerException):
    """Error raised when a metric does not exist."""
    def __init__(self, metric):
        super(NoSuchMetric, self).__init__("Metric %s does not exist" %
                                           metric)
        self.metric = metric


class NoSuchResource(IndexerException):
    """Error raised when a resource does not exist."""
    def __init__(self, resource):
        super(NoSuchResource, self).__init__("Resource %s does not exist" %
                                             resource)
        self.resource = resource


class NoSuchArchivePolicy(IndexerException):
github gnocchixyz / gnocchi / gnocchi / indexer / __init__.py View on Github external
super(QueryError, self).__init__("Invalid value: `%s' for field `%s'"
                                         % (v, f))


class QueryInvalidOperator(QueryError):
    def __init__(self, op):
        self.op = op
        super(QueryError, self).__init__("Unknown operator `%s'" % op)


class QueryAttributeError(QueryError, ResourceAttributeError):
    def __init__(self, resource, attribute):
        ResourceAttributeError.__init__(self, resource, attribute)


class InvalidPagination(IndexerException):
    """Error raised when a resource does not exist."""
    def __init__(self, reason):
        self.reason = reason
        super(InvalidPagination, self).__init__(
            "Invalid pagination: `%s'" % reason)


class IndexerDriver(object):
    @staticmethod
    def __init__(conf):
        pass

    @staticmethod
    def disconnect():
        pass
github gnocchixyz / gnocchi / gnocchi / indexer / __init__.py View on Github external
"""Error raised when a metric does not exist."""
    def __init__(self, metric):
        super(NoSuchMetric, self).__init__("Metric %s does not exist" %
                                           metric)
        self.metric = metric


class NoSuchResource(IndexerException):
    """Error raised when a resource does not exist."""
    def __init__(self, resource):
        super(NoSuchResource, self).__init__("Resource %s does not exist" %
                                             resource)
        self.resource = resource


class NoSuchArchivePolicy(IndexerException):
    """Error raised when an archive policy does not exist."""
    def __init__(self, archive_policy):
        super(NoSuchArchivePolicy, self).__init__(
            "Archive policy %s does not exist" % archive_policy)
        self.archive_policy = archive_policy

    def jsonify(self):
        return {
            "cause": "Archive policy does not exist",
            "detail": self.archive_policy,
        }


class UnsupportedArchivePolicyChange(IndexerException):
    """Error raised when modifying archive policy if not supported."""
    def __init__(self, archive_policy, message):