Source code for rucio.common.exception

# Copyright European Organization for Nuclear Research (CERN)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Authors:
# - Thomas Beermann, <thomas.beermann@cern.ch> , 2012
# - Angelos Molfetas, <angelos.molfetas@cern,ch>, 2012
# - Mario Lassnig, <mario.lassnig@cern.ch>, 2012, 2014-2015
# - Vincent Garonne, <vincent.garonne@cern.ch>, 2011-2013
# - Ralph Vigne, <ralph.vigne@cern.ch>, 2012-2013
# - Martin Barisits, <martin.barisits@cern.ch>, 2012-2016
# - Cedric Serfon, <cedric.serfon@cern.ch>, 2013-2017
# - Wen Guan, <wen.guan@cern.ch>, 2014


"""Exceptions used with Rucio.

The base exception class is :class:`. RucioException`.
Exceptions which are raised are all subclasses of it.

"""

from rucio.common.constraints import AUTHORIZED_VALUE_TYPES


[docs]class RucioException(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. """ def __init__(self, *args, **kwargs): super(RucioException, self).__init__(args, kwargs) self._message = "An unknown exception occurred." self.args = args self.kwargs = kwargs self._error_string = None def __str__(self): try: self._error_string = self._message % self.kwargs except Exception: # at least get the core message out if something happened self._error_string = self._message if len(self.args) > 0: # If there is a non-kwarg parameter, assume it's the error # message or reason description and tack it on to the end # of the exception message # Convert all arguments into their string representations... args = ["%s" % arg for arg in self.args if arg] self._error_string = (self._error_string + "\nDetails: %s" % '\n'.join(args)) return self._error_string.strip()
# Please insert new exceptions in alphabetic order
[docs]class AccessDenied(RucioException): """ AccessDenied """ def __init__(self, *args, **kwargs): super(AccessDenied, self).__init__(args, kwargs) self._message = "Access to the requested resource denied."
[docs]class AccountNotFound(RucioException): """ AccountNotFound """ def __init__(self, *args, **kwargs): super(AccountNotFound, self).__init__(args, kwargs) self._message = "Account does not exist."
[docs]class CannotAuthenticate(RucioException): """ CannotAuthenticate """ def __init__(self, *args, **kwargs): super(CannotAuthenticate, self).__init__(args, kwargs) self._message = "Cannot authenticate."
[docs]class ClientParameterMismatch(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(ClientParameterMismatch, self).__init__(args, kwargs) self._message = "Client parameters don\'t match."
[docs]class ClientProtocolNotSupported(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(ClientProtocolNotSupported, self).__init__(args, kwargs) self._message = "Client protocol not supported."
[docs]class ConfigNotFound(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(ConfigNotFound, self).__init__(args, kwargs) self._message = "Configuration not found."
[docs]class ConfigurationError(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(ConfigurationError, self).__init__(args, kwargs) self._message = "Error during configuration."
[docs]class CounterNotFound(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(CounterNotFound, self).__init__(args, kwargs) self._message = "The requested counter does not exist."
[docs]class DatabaseException(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(DatabaseException, self).__init__(args, kwargs) self._message = "Database exception."
[docs]class DataIdentifierAlreadyExists(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(DataIdentifierAlreadyExists, self).__init__(args, kwargs) self._message = "Data Identifier Already Exists."
[docs]class DataIdentifierNotFound(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(DataIdentifierNotFound, self).__init__(args, kwargs) self._message = "Data identifier not found."
[docs]class DestinationNotAccessible(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(DestinationNotAccessible, self).__init__(args, kwargs) self._message = "Access to local destination denied."
[docs]class Duplicate(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(Duplicate, self).__init__(args, kwargs) self._message = "An object with the same identifier already exists."
[docs]class DuplicateContent(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(DuplicateContent, self).__init__(args, kwargs) self._message = "Data identifier already added to the destination content."
[docs]class DuplicateRule(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(DuplicateRule, self).__init__(args, kwargs) self._message = "A duplicate rule for this account, did, rse_expression, copies already exists."
[docs]class ErrorLoadingCredentials(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(ErrorLoadingCredentials, self).__init__(args, kwargs) self._message = "Unable to to load user credentials."
[docs]class FileAlreadyExists(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(FileAlreadyExists, self).__init__(args, kwargs) self._message = "The file already exists."
[docs]class FileConsistencyMismatch(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(FileConsistencyMismatch, self).__init__(args, kwargs) self._message = "Error related to file consistency."
[docs]class FileReplicaAlreadyExists(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(FileReplicaAlreadyExists, self).__init__(args, kwargs) self._message = "File name in specified scope already exists"
[docs]class ReplicaNotFound(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(ReplicaNotFound, self).__init__(args, kwargs) self._message = "Replica not found"
[docs]class ReplicaUnAvailable(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(ReplicaUnAvailable, self).__init__(args, kwargs) self._message = "Replica unavailable"
[docs]class FullStorage(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(FullStorage, self).__init__(args, kwargs) self._message = "The Referenced storage is out of disk space."
[docs]class IdentityError(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(IdentityError, self).__init__(args, kwargs) self._message = "Identity error."
[docs]class IdentityNotFound(RucioException): def __init__(self, *args, **kwargs): super(IdentityNotFound, self).__init__(args, kwargs) self._message = "This identity does not exist."
[docs]class InputValidationError(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(InputValidationError, self).__init__(args, kwargs) self._message = "There is an error with one of the input parameters."
[docs]class InsufficientAccountLimit(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(InsufficientAccountLimit, self).__init__(args, kwargs) self._message = "There is not enough quota left to fulfil the operation."
[docs]class InsufficientTargetRSEs(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(InsufficientTargetRSEs, self).__init__(args, kwargs) self._message = "There are not enough target RSEs to fulfil the request at this time."
[docs]class InvalidMetadata(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(InvalidMetadata, self).__init__(args, kwargs) self._message = "Provided metadata is considered invalid."
[docs]class InvalidObject(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(InvalidObject, self).__init__(args, kwargs) self._message = "Provided object does not match schema."
[docs]class InvalidReplicationRule(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(InvalidReplicationRule, self).__init__(args, kwargs) self._message = "Provided replication rule is considered invalid."
[docs]class InvalidRSEExpression(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(InvalidRSEExpression, self).__init__(args, kwargs) self._message = "Provided RSE expression is considered invalid."
[docs]class InvalidRuleWeight(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(InvalidRuleWeight, self).__init__(args, kwargs) self._message = "An invalid weight value/type is used for an RSE."
[docs]class InvalidType(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(InvalidType, self).__init__(args, kwargs) self._message = "Provided type is considered invalid."
[docs]class InvalidValueForKey(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(InvalidValueForKey, self).__init__(args, kwargs) self._message = "Invalid value for the key."
[docs]class InvalidRequest(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(InvalidRequest, self).__init__(args, kwargs) self._message = "Request is considered invalid."
[docs]class InvalidPath(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(InvalidPath, self).__init__(args, kwargs) self._message = "The path provided is invalid."
[docs]class KeyNotFound(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(KeyNotFound, self).__init__(args, kwargs) self._message = "Key does not exist."
[docs]class LifetimeExceptionDuplicate(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(LifetimeExceptionDuplicate, self).__init__(args, kwargs) self._message = "An exception already exists."
[docs]class LifetimeExceptionNotFound(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(LifetimeExceptionNotFound, self).__init__(args, kwargs) self._message = "Exception does not exist."
[docs]class ManualRuleApprovalBlocked(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(ManualRuleApprovalBlocked, self).__init__(args, kwargs) self._message = "Manual rule approval is blocked on this RSE."
[docs]class MissingClientParameter(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(MissingClientParameter, self).__init__(args, kwargs) self._message = "Client parameters are missing."
[docs]class MissingDependency(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(MissingDependency, self).__init__(args, kwargs) self._message = "One dependency is missing."
[docs]class MissingSourceReplica(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(MissingSourceReplica, self).__init__(args, kwargs) self._message = "Source replicas are missing to fulfil the request at this moment."
[docs]class NameTypeError(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(NameTypeError, self).__init__(args, kwargs) self._message = "Name is of the wrong type"
[docs]class NoAuthInformation(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(NoAuthInformation, self).__init__(args, kwargs) self._message = "No authentication information passed."
[docs]class ReplicationRuleCreationTemporaryFailed(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(ReplicationRuleCreationTemporaryFailed, self).__init__(args, kwargs) self._message = "The creation of the replication rule failed at this time. Please try again later."
[docs]class RequestNotFound(RucioException): def __init__(self, *args, **kwargs): super(RequestNotFound, self).__init__(args, kwargs) self._message = "A request for this DID and RSE does not exist."
[docs]class RSEAccessDenied(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(RSEAccessDenied, self).__init__(args, kwargs) self._message = "Referenced RSE not reachable."
[docs]class RSEBlacklisted(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(RSEBlacklisted, self).__init__(args, kwargs) self._message = "RSE excluded due to write blacklisting."
[docs]class RSENotConnected(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(RSENotConnected, self).__init__(args, kwargs) self._message = "Connection to RSE not established."
[docs]class RSENotFound(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(RSENotFound, self).__init__(args, kwargs) self._message = "RSE does not exist."
[docs]class RSEProtocolNotSupported(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(RSEProtocolNotSupported, self).__init__(args, kwargs) self._message = "RSE does not support requested protocol."
[docs]class RSEProtocolPriorityError(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(RSEProtocolPriorityError, self).__init__(args, kwargs) self._message = "RSE does not support provided protocol priority for protocol."
[docs]class RSEProtocolDomainNotSupported(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(RSEProtocolDomainNotSupported, self).__init__(args, kwargs) self._message = "RSE does not support requested protocol scope."
[docs]class RSEOperationNotSupported(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(RSEOperationNotSupported, self).__init__(args, kwargs) self._message = "RSE does not support requested operation."
[docs]class RSEFileNameNotSupported(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(RSEFileNameNotSupported, self).__init__(args, kwargs) self._message = "RSE does not support provided filename."
[docs]class RSEOverQuota(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(RSEOverQuota, self).__init__(args, kwargs) self._message = "Quota of Referenced RSE is exceeded."
[docs]class ResourceTemporaryUnavailable(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(ResourceTemporaryUnavailable, self).__init__(args, kwargs) self._message = "The resource is temporary not available."
[docs]class RuleNotFound(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(RuleNotFound, self).__init__(args, kwargs) self._message = "No replication rule found."
[docs]class RuleReplaceFailed(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(RuleReplaceFailed, self).__init__(args, kwargs) self._message = "The replace operation for the rule failed."
[docs]class ScratchDiskLifetimeConflict(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(ScratchDiskLifetimeConflict, self).__init__(args, kwargs) self._message = "The requested replication rule exceeds the maximum SCRATCHDISK lifetime of 15 days."
[docs]class ServiceUnavailable(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(ServiceUnavailable, self).__init__(args, kwargs) self._message = "The requested service is not available at the moment."
[docs]class ScopeAccessDenied(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(ScopeAccessDenied, self).__init__(args, kwargs) self._message = "Access to Referenced scope denied."
[docs]class ScopeNotFound(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(ScopeNotFound, self).__init__(args, kwargs) self._message = "Scope does not exist."
[docs]class SourceAccessDenied(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(SourceAccessDenied, self).__init__(args, kwargs) self._message = "Access to local source file denied."
[docs]class SourceNotFound(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(SourceNotFound, self).__init__(args, kwargs) self._message = "Source file not found."
[docs]class StagingAreaRuleRequiresLifetime(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(StagingAreaRuleRequiresLifetime, self).__init__(args, kwargs) self._message = "A rule involving a staging area requires a lifetime!"
[docs]class SubscriptionDuplicate(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(SubscriptionDuplicate, self).__init__(args, kwargs) self._message = "A subscription with the same identifier already exists."
[docs]class SubscriptionNotFound(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(SubscriptionNotFound, self).__init__(args, kwargs) self._message = "Subscription not found."
[docs]class UnsupportedOperation(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(UnsupportedOperation, self).__init__(args, kwargs) self._message = "The resource doesn't support the requested operation."
[docs]class UnsupportedStatus(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(UnsupportedStatus, self).__init__(args, kwargs) self._message = "Unsupported data identifier status."
[docs]class UnsupportedValueType(RucioException): """ RucioException """ def __init__(self, *args, **kwargs): super(UnsupportedValueType, self).__init__(args, kwargs) self._message = "Unsupported type for the value. List of supported types: %s." % str(AUTHORIZED_VALUE_TYPES)