diff --git a/irods/__init__.py b/irods/__init__.py index 4b54842b51..648f085c69 100644 --- a/irods/__init__.py +++ b/irods/__init__.py @@ -1,7 +1,7 @@ import logging # iRODS settings -IRODS_VERSION = {'major':4, 'minor':1, 'patchlevel':6, 'api':'d'} +IRODS_VERSION = {'major': 4, 'minor': 1, 'patchlevel': 6, 'api': 'd'} # Magic Numbers MAX_PASSWORD_LENGTH = 50 @@ -15,7 +15,7 @@ logger = logging.getLogger() logger.setLevel(logging.ERROR) h = logging.StreamHandler() -f = logging.Formatter("%(asctime)s %(name)s-%(levelname)s [%(pathname)s %(lineno)d] %(message)s") +f = logging.Formatter( + "%(asctime)s %(name)s-%(levelname)s [%(pathname)s %(lineno)d] %(message)s") h.setFormatter(f) logger.addHandler(h) - diff --git a/irods/account.py b/irods/account.py index 98c7b62de3..ec15747d2e 100644 --- a/irods/account.py +++ b/irods/account.py @@ -1,6 +1,7 @@ class iRODSAccount(object): - def __init__(self, host, port, user, zone, password, client_user=None, - client_zone=None): + + def __init__(self, host, port, user, zone, password, client_user=None, + client_zone=None): self.host = host self.port = port diff --git a/irods/collection.py b/irods/collection.py index f468133209..5d0f789dde 100644 --- a/irods/collection.py +++ b/irods/collection.py @@ -6,7 +6,9 @@ from irods.data_object import iRODSDataObject from irods.meta import iRODSMetaCollection + class iRODSCollection(object): + def __init__(self, manager, result=None): self.manager = manager if result: @@ -18,8 +20,8 @@ def __init__(self, manager, result=None): @property def metadata(self): if not self._meta: - self._meta = iRODSMetaCollection(self.manager.sess.metadata, - Collection, self.path) + self._meta = iRODSMetaCollection(self.manager.sess.metadata, + Collection, self.path) return self._meta @property @@ -34,22 +36,24 @@ def data_objects(self): query = self.manager.sess.query(DataObject)\ .filter(DataObject.collection_id == self.id) results = query.get_results() - grouped = itertools.groupby(results, operator.itemgetter(DataObject.id)) + grouped = itertools.groupby( + results, operator.itemgetter(DataObject.id)) return [ - iRODSDataObject(self.manager.sess.data_objects, self, list(replicas)) + iRODSDataObject( + self.manager.sess.data_objects, self, list(replicas)) for _, replicas in grouped ] def remove(self, recurse=True, force=False, additional_flags={}): self.manager.remove(self.path, recurse, force, additional_flags) - + def move(self, path): self.manager.move(self.path, path) def walk(self, topdown=True): """ Collection tree generator. - + For each subcollection in the directory tree, starting at the collection, yield a 3-tuple """ diff --git a/irods/column.py b/irods/column.py index ad21a96d68..f15a4f564d 100644 --- a/irods/column.py +++ b/irods/column.py @@ -1,7 +1,9 @@ from datetime import datetime from calendar import timegm + class QueryKey(object): + def __init__(self, type): self.type = type @@ -23,13 +25,17 @@ def __gt__(self, other): def __ge__(self, other): return Criterion('>=', self, other) + class Criterion(object): + def __init__(self, op, query_key, value): self.op = op self.query_key = query_key self.value = self.query_key.type.to_irods(value) + class Column(QueryKey): + def __init__(self, type, icat_key, icat_id): self.icat_key = icat_key self.icat_id = icat_id @@ -37,19 +43,24 @@ def __init__(self, type, icat_key, icat_id): def __repr__(self): return "<%s.%s %d %s>" % ( - self.__class__.__module__, - self.__class__.__name__, - self.icat_id, + self.__class__.__module__, + self.__class__.__name__, + self.icat_id, self.icat_key ) + class Keyword(QueryKey): + def __init__(self, type, icat_key): self.icat_key = icat_key super(Keyword, self).__init__(type) - -#consider renaming columnType + +# consider renaming columnType + + class ColumnType(object): + @staticmethod def to_python(self): pass @@ -58,16 +69,20 @@ def to_python(self): def to_irods(data): pass + class Integer(ColumnType): + @staticmethod def to_python(str): - return int(str) + return int(str) @staticmethod def to_irods(data): return "'%s'" % str(data) + class String(ColumnType): + @staticmethod def to_python(str): return str @@ -76,7 +91,9 @@ def to_python(str): def to_irods(data): return "'%s'" % data + class DateTime(ColumnType): + @staticmethod def to_python(str): return datetime.utcfromtimestamp(int(str)) diff --git a/irods/data_object.py b/irods/data_object.py index 77758aa00d..cff2e9b0e0 100644 --- a/irods/data_object.py +++ b/irods/data_object.py @@ -8,6 +8,7 @@ class iRODSReplica(object): + def __init__(self, status, resource_name, path): self.status = status self.resource_name = resource_name @@ -20,7 +21,9 @@ def __repr__(self): self.resource_name ) + class iRODSDataObject(object): + def __init__(self, manager, parent=None, results=None): self.manager = manager if parent and results: @@ -33,7 +36,8 @@ def __init__(self, manager, parent=None, results=None): # backward compatibility with pre iRODS 4 sys.exc_clear() self.path = self.collection.path + '/' + self.name - replicas = sorted(results, key=lambda r: r[DataObject.replica_number]) + replicas = sorted( + results, key=lambda r: r[DataObject.replica_number]) self.replicas = [iRODSReplica( r[DataObject.replica_status], r[DataObject.resource_name], @@ -47,7 +51,8 @@ def __repr__(self): @property def metadata(self): if not self._meta: - self._meta = iRODSMetaCollection(self.manager.sess.metadata, DataObject, self.path) + self._meta = iRODSMetaCollection( + self.manager.sess.metadata, DataObject, self.path) return self._meta def open(self, mode='r'): @@ -75,7 +80,9 @@ def replicate(self, resource): options[kw.DEST_RESC_NAME_KW] = resource self.manager.replicate(self.path, options) + class iRODSDataObjectFileRaw(RawIOBase): + def __init__(self, conn, descriptor): self.conn = conn self.desc = descriptor diff --git a/irods/exception.py b/irods/exception.py index 884c68608c..e950a924fe 100644 --- a/irods/exception.py +++ b/irods/exception.py @@ -1,977 +1,1867 @@ # if you're copying these from the docs, you might find the following regex helpful: # s/\(\w\+\)\s\+\(-\d\+\)/class \1(SystemException):\r code = \2/g + class PycommandsException(Exception): pass + class NetworkException(PycommandsException): pass + class DoesNotExist(PycommandsException): pass + class DataObjectDoesNotExist(PycommandsException): pass + class CollectionDoesNotExist(PycommandsException): pass + class UserDoesNotExist(PycommandsException): pass + class UserGroupDoesNotExist(PycommandsException): pass + class ResourceDoesNotExist(PycommandsException): pass + class QueryException(PycommandsException): pass + class NoResultFound(QueryException): pass + class MultipleResultsFound(QueryException): pass + class iRODSExceptionMeta(type): codes = {} + def __init__(self, name, bases, attrs): if 'code' in attrs: iRODSExceptionMeta.codes[attrs['code']] = self + class iRODSException(Exception): __metaclass__ = iRODSExceptionMeta pass + def get_exception_by_code(code): return iRODSExceptionMeta.codes[code]() + class SystemException(iRODSException): pass + class SYS_SOCK_OPEN_ERR(SystemException): code = -1000 + + class SYS_SOCK_BIND_ERR(SystemException): code = -2000 + + class SYS_SOCK_ACCEPT_ERR(SystemException): code = -3000 + + class SYS_HEADER_READ_LEN_ERR(SystemException): code = -4000 + + class SYS_HEADER_WRITE_LEN_ERR(SystemException): code = -5000 + + class SYS_HEADER_TPYE_LEN_ERR(SystemException): code = -6000 + + class SYS_CAUGHT_SIGNAL(SystemException): code = -7000 + + class SYS_GETSTARTUP_PACK_ERR(SystemException): code = -8000 + + class SYS_EXCEED_CONNECT_CNT(SystemException): code = -9000 + + class SYS_USER_NOT_ALLOWED_TO_CONN(SystemException): code = -10000 + + class SYS_READ_MSG_BODY_INPUT_ERR(SystemException): code = -11000 + + class SYS_UNMATCHED_API_NUM(SystemException): code = -12000 + + class SYS_NO_API_PRIV(SystemException): code = -13000 + + class SYS_API_INPUT_ERR(SystemException): code = -14000 + + class SYS_PACK_INSTRUCT_FORMAT_ERR(SystemException): code = -15000 + + class SYS_MALLOC_ERR(SystemException): code = -16000 + + class SYS_GET_HOSTNAME_ERR(SystemException): code = -17000 + + class SYS_OUT_OF_FILE_DESC(SystemException): code = -18000 + + class SYS_FILE_DESC_OUT_OF_RANGE(SystemException): code = -19000 + + class SYS_UNRECOGNIZED_REMOTE_FLAG(SystemException): code = -20000 + + class SYS_INVALID_SERVER_HOST(SystemException): code = -21000 + + class SYS_SVR_TO_SVR_CONNECT_FAILED(SystemException): code = -22000 + + class SYS_BAD_FILE_DESCRIPTOR(SystemException): code = -23000 + + class SYS_INTERNAL_NULL_INPUT_ERR(SystemException): code = -24000 + + class SYS_CONFIG_FILE_ERR(SystemException): code = -25000 + + class SYS_INVALID_ZONE_NAME(SystemException): code = -26000 + + class SYS_COPY_LEN_ERR(SystemException): code = -27000 + + class SYS_PORT_COOKIE_ERR(SystemException): code = -28000 + + class SYS_KEY_VAL_TABLE_ERR(SystemException): code = -29000 + + class SYS_INVALID_RESC_TYPE(SystemException): code = -30000 + + class SYS_INVALID_FILE_PATH(SystemException): code = -31000 + + class SYS_INVALID_RESC_INPUT(SystemException): code = -32000 + + class SYS_INVALID_PORTAL_OPR(SystemException): code = -33000 + + class SYS_PARA_OPR_NO_SUPPORT(SystemException): code = -34000 + + class SYS_INVALID_OPR_TYPE(SystemException): code = -35000 + + class SYS_NO_PATH_PERMISSION(SystemException): code = -36000 + + class SYS_NO_ICAT_SERVER_ERR(SystemException): code = -37000 + + class SYS_AGENT_INIT_ERR(SystemException): code = -38000 + + class SYS_PROXYUSER_NO_PRIV(SystemException): code = -39000 + + class SYS_NO_DATA_OBJ_PERMISSION(SystemException): code = -40000 + + class SYS_DELETE_DISALLOWED(SystemException): code = -41000 + + class SYS_OPEN_REI_FILE_ERR(SystemException): code = -42000 + + class SYS_NO_RCAT_SERVER_ERR(SystemException): code = -43000 + + class SYS_UNMATCH_PACK_INSTRUCTI_NAME(SystemException): code = -44000 + + class SYS_SVR_TO_CLI_MSI_NO_EXIST(SystemException): code = -45000 + + class SYS_COPY_ALREADY_IN_RESC(SystemException): code = -46000 + + class SYS_RECONN_OPR_MISMATCH(SystemException): code = -47000 + + class SYS_INPUT_PERM_OUT_OF_RANGE(SystemException): code = -48000 + + class SYS_FORK_ERROR(SystemException): code = -49000 + + class SYS_PIPE_ERROR(SystemException): code = -50000 + + class SYS_EXEC_CMD_STATUS_SZ_ERROR(SystemException): code = -51000 + + class SYS_PATH_IS_NOT_A_FILE(SystemException): code = -52000 + + class SYS_UNMATCHED_SPEC_COLL_TYPE(SystemException): code = -53000 + + class SYS_TOO_MANY_QUERY_RESULT(SystemException): code = -54000 + + class SYS_SPEC_COLL_NOT_IN_CACHE(SystemException): code = -55000 + + class SYS_SPEC_COLL_OBJ_NOT_EXIST(SystemException): code = -56000 + + class SYS_REG_OBJ_IN_SPEC_COLL(SystemException): code = -57000 + + class SYS_DEST_SPEC_COLL_SUB_EXIST(SystemException): code = -58000 + + class SYS_SRC_DEST_SPEC_COLL_CONFLICT(SystemException): code = -59000 + + class SYS_UNKNOWN_SPEC_COLL_CLASS(SystemException): code = -60000 + + class SYS_DUPLICATE_XMSG_TICKET(SystemException): code = -61000 + + class SYS_UNMATCHED_XMSG_TICKET(SystemException): code = -62000 + + class SYS_NO_XMSG_FOR_MSG_NUMBER(SystemException): - code = -63000 + code = -63000 + + class SYS_COLLINFO_2_FORMAT_ERR(SystemException): - code = -64000 + code = -64000 + + class SYS_CACHE_STRUCT_FILE_RESC_ERR(SystemException): - code = -65000 + code = -65000 + + class SYS_NOT_SUPPORTED(SystemException): code = -66000 + + class SYS_TAR_STRUCT_FILE_EXTRACT_ERR(SystemException): code = -67000 + + class SYS_STRUCT_FILE_DESC_ERR(SystemException): code = -68000 + + class SYS_TAR_OPEN_ERR(SystemException): code = -69000 + + class SYS_TAR_EXTRACT_ALL_ERR(SystemException): code = -70000 + + class SYS_TAR_CLOSE_ERR(SystemException): code = -71000 + + class SYS_STRUCT_FILE_PATH_ERR(SystemException): code = -72000 + + class SYS_MOUNT_MOUNTED_COLL_ERR(SystemException): code = -73000 + + class SYS_COLL_NOT_MOUNTED_ERR(SystemException): code = -74000 + + class SYS_STRUCT_FILE_BUSY_ERR(SystemException): code = -75000 + + class SYS_STRUCT_FILE_INMOUNTED_COLL(SystemException): code = -76000 + + class SYS_COPY_NOT_EXIST_IN_RESC(SystemException): code = -77000 + + class SYS_RESC_DOES_NOT_EXIST(SystemException): code = -78000 + + class SYS_COLLECTION_NOT_EMPTY(SystemException): code = -79000 + + class SYS_OBJ_TYPE_NOT_STRUCT_FILE(SystemException): code = -80000 + + class SYS_WRONG_RESC_POLICY_FOR_BUN_OPR(SystemException): code = -81000 + + class SYS_DIR_IN_VAULT_NOT_EMPTY(SystemException): code = -82000 + + class SYS_OPR_FLAG_NOT_SUPPORT(SystemException): code = -83000 + + class SYS_TAR_APPEND_ERR(SystemException): code = -84000 + + class SYS_INVALID_PROTOCOL_TYPE(SystemException): code = -85000 + + class SYS_UDP_CONNECT_ERR(SystemException): code = -86000 + + class SYS_UDP_TRANSFER_ERR(SystemException): code = -89000 + + class SYS_UDP_NO_SUPPORT_ERR(SystemException): code = -90000 + + class SYS_READ_MSG_BODY_LEN_ERR(SystemException): code = -91000 + + class CROSS_ZONE_SOCK_CONNECT_ERR(SystemException): code = -92000 + + class SYS_NO_FREE_RE_THREAD(SystemException): code = -93000 + + class SYS_BAD_RE_THREAD_INX(SystemException): code = -94000 + + class SYS_CANT_DIRECTLY_ACC_COMPOUND_RESC(SystemException): code = -95000 + + class SYS_SRC_DEST_RESC_COMPOUND_TYPE(SystemException): code = -96000 + + class SYS_CACHE_RESC_NOT_ON_SAME_HOST(SystemException): code = -97000 + + class SYS_NO_CACHE_RESC_IN_GRP(SystemException): code = -98000 + + class SYS_UNMATCHED_RESC_IN_RESC_GRP(SystemException): code = -99000 + + class SYS_CANT_MV_BUNDLE_DATA_TO_TRASH(SystemException): code = -100000 + + class SYS_CANT_MV_BUNDLE_DATA_BY_COPY(SystemException): code = -101000 + + class SYS_EXEC_TAR_ERR(SystemException): code = -102000 + + class SYS_CANT_CHKSUM_COMP_RESC_DATA(SystemException): code = -103000 + + class SYS_CANT_CHKSUM_BUNDLED_DATA(SystemException): code = -104000 + + class SYS_RESC_IS_DOWN(SystemException): code = -105000 + + class SYS_UPDATE_REPL_INFO_ERR(SystemException): code = -106000 + + class SYS_COLL_LINK_PATH_ERR(SystemException): code = -107000 + + class SYS_LINK_CNT_EXCEEDED_ERR(SystemException): code = -108000 + + class SYS_CROSS_ZONE_MV_NOT_SUPPORTED(SystemException): code = -109000 + + class SYS_RESC_QUOTA_EXCEEDED(SystemException): code = -110000 + class UserInputException(iRODSException): pass + class USER_AUTH_SCHEME_ERR(UserInputException): code = -300000 + + class USER_AUTH_STRING_EMPTY(UserInputException): code = -301000 + + class USER_RODS_HOST_EMPTY(UserInputException): code = -302000 + + class USER_RODS_HOSTNAME_ERR(UserInputException): code = -303000 + + class USER_SOCK_OPEN_ERR(UserInputException): code = -304000 + + class USER_SOCK_CONNECT_ERR(UserInputException): code = -305000 + + class USER_STRLEN_TOOLONG(UserInputException): code = -306000 + + class USER_API_INPUT_ERR(UserInputException): code = -307000 + + class USER_PACKSTRUCT_INPUT_ERR(UserInputException): code = -308000 + + class USER_NO_SUPPORT_ERR(UserInputException): code = -309000 + + class USER_FILE_DOES_NOT_EXIST(UserInputException): code = -310000 + + class USER_FILE_TOO_LARGE(UserInputException): code = -311000 -class OVERWITE_WITHOUT_FORCE_FLAG(UserInputException): + + +class OVERWITE_WITHOUT_FORCE_FLAG(UserInputException): code = -312000 + + class UNMATCHED_KEY_OR_INDEX(UserInputException): code = -313000 + + class USER_CHKSUM_MISMATCH(UserInputException): code = -314000 + + class USER_BAD_KEYWORD_ERR(UserInputException): code = -315000 + + class USER__NULL_INPUT_ERR(UserInputException): code = -316000 + + class USER_INPUT_PATH_ERR(UserInputException): code = -317000 + + class USER_INPUT_OPTION_ERR(UserInputException): code = -318000 + + class USER_INVALID_USERNAME_FORMAT(UserInputException): code = -319000 + + class USER_DIRECT_RESC_INPUT_ERR(UserInputException): code = -320000 + + class USER_NO_RESC_INPUT_ERR(UserInputException): code = -321000 + + class USER_PARAM_LABEL_ERR(UserInputException): code = -322000 + + class USER_PARAM_TYPE_ERR(UserInputException): code = -323000 + + class BASE64_BUFFER_OVERFLOW(UserInputException): code = -324000 + + class BASE64_INVALID_PACKET(UserInputException): code = -325000 + + class USER_MSG_TYPE_NO_SUPPORT(UserInputException): code = -326000 + + class USER_RSYNC_NO_MODE_INPUT_ERR(UserInputException): code = -337000 + + class USER_OPTION_INPUT_ERR(UserInputException): code = -338000 + + class SAME_SRC_DEST_PATHS_ERR(UserInputException): code = -339000 + + class USER_RESTART_FILE_INPUT_ERR(UserInputException): code = -340000 + + class RESTART_OPR_FAILED(UserInputException): code = -341000 + + class BAD_EXEC_CMD_PATH(UserInputException): code = -342000 + + class EXEC_CMD_OUTPUT_TOO_LARGE(UserInputException): code = -343000 + + class EXEC_CMD_ERROR(UserInputException): code = -344000 + + class BAD_INPUT_DESC_INDEX(UserInputException): code = -345000 + + class USER_PATH_EXCEEDS_MAX(UserInputException): code = -346000 + + class USER_SOCK_CONNECT_TIMEDOUT(UserInputException): code = -347000 + + class USER_API_VERSION_MISMATCH(UserInputException): code = -348000 + + class USER_INPUT_FORMAT_ERR(UserInputException): code = -349000 + + class USER_ACCESS_DENIED(UserInputException): code = -350000 + + class CANT_RM_MV_BUNDLE_TYPE(UserInputException): code = -351000 + + class NO_MORE_RESULT(UserInputException): code = -352000 + + class NO_KEY_WD_IN_MS_INP_STR(UserInputException): code = -353000 + + class CANT_RM_NON_EMPTY_HOME_COLL(UserInputException): code = -354000 + + class CANT_UNREG_IN_VAULT_FILE(UserInputException): code = -355000 + + class NO_LOCAL_FILE_RSYNC_IN_MSI(UserInputException): code = -356000 + class FileDriverException(iRODSException): pass + class FILE_INDEX_LOOKUP_ERR(FileDriverException): - code = -500000 + code = -500000 + + class UNIX_FILE_OPEN_ERR(FileDriverException): - code = -510000 + code = -510000 + + class UNIX_FILE_CREATE_ERR(FileDriverException): - code = -511000 + code = -511000 + + class UNIX_FILE_READ_ERR(FileDriverException): - code = -512000 + code = -512000 + + class UNIX_FILE_WRITE_ERR(FileDriverException): - code = -513000 + code = -513000 + + class UNIX_FILE_CLOSE_ERR(FileDriverException): - code = -514000 + code = -514000 + + class UNIX_FILE_UNLINK_ERR(FileDriverException): - code = -515000 + code = -515000 + + class UNIX_FILE_STAT_ERR(FileDriverException): - code = -516000 + code = -516000 + + class UNIX_FILE_FSTAT_ERR(FileDriverException): - code = -517000 + code = -517000 + + class UNIX_FILE_LSEEK_ERR(FileDriverException): - code = -518000 + code = -518000 + + class UNIX_FILE_FSYNC_ERR(FileDriverException): - code = -519000 + code = -519000 + + class UNIX_FILE_MKDIR_ERR(FileDriverException): - code = -520000 + code = -520000 + + class UNIX_FILE_RMDIR_ERR(FileDriverException): - code = -521000 + code = -521000 + + class UNIX_FILE_OPENDIR_ERR(FileDriverException): - code = -522000 + code = -522000 + + class UNIX_FILE_CLOSEDIR_ERR(FileDriverException): - code = -523000 + code = -523000 + + class UNIX_FILE_READDIR_ERR(FileDriverException): - code = -524000 + code = -524000 + + class UNIX_FILE_STAGE_ERR(FileDriverException): - code = -525000 + code = -525000 + + class UNIX_FILE_GET_FS_FREESPACE_ERR(FileDriverException): - code = -526000 + code = -526000 + + class UNIX_FILE_CHMOD_ERR(FileDriverException): - code = -527000 + code = -527000 + + class UNIX_FILE_RENAME_ERR(FileDriverException): - code = -528000 + code = -528000 + + class UNIX_FILE_TRUNCATE_ERR(FileDriverException): - code = -529000 + code = -529000 + + class UNIX_FILE_LINK_ERR(FileDriverException): code = -530000 + class UniversalMSSDriverException(FileDriverException): pass + class UNIV_MSS_SYNCTOARCH_ERR(UniversalMSSDriverException): code = -550000 + + class UNIV_MSS_STAGETOCACHE_ERR(UniversalMSSDriverException): code = -551000 + + class UNIV_MSS_UNLINK_ERR(UniversalMSSDriverException): code = -552000 + + class UNIV_MSS_MKDIR_ERR(UniversalMSSDriverException): code = -553000 + + class UNIV_MSS_CHMOD_ERR(UniversalMSSDriverException): code = -554000 + + class UNIV_MSS_STAT_ERR(UniversalMSSDriverException): code = -555000 + class HPSSDriverException(FileDriverException): pass + class HPSS_AUTH_NOT_SUPPORTED(HPSSDriverException): code = -600000 + + class HPSS_FILE_OPEN_ERR(HPSSDriverException): code = -610000 + + class HPSS_FILE_CREATE_ERR(HPSSDriverException): code = -611000 + + class HPSS_FILE_READ_ERR(HPSSDriverException): code = -612000 + + class HPSS_FILE_WRITE_ERR(HPSSDriverException): code = -613000 + + class HPSS_FILE_CLOSE_ERR(HPSSDriverException): code = -614000 + + class HPSS_FILE_UNLINK_ERR(HPSSDriverException): code = -615000 + + class HPSS_FILE_STAT_ERR(HPSSDriverException): code = -616000 + + class HPSS_FILE_FSTAT_ERR(HPSSDriverException): code = -617000 + + class HPSS_FILE_LSEEK_ERR(HPSSDriverException): code = -618000 + + class HPSS_FILE_FSYNC_ERR(HPSSDriverException): code = -619000 + + class HPSS_FILE_MKDIR_ERR(HPSSDriverException): code = -620000 + + class HPSS_FILE_RMDIR_ERR(HPSSDriverException): code = -621000 + + class HPSS_FILE_OPENDIR_ERR(HPSSDriverException): code = -622000 + + class HPSS_FILE_CLOSEDIR_ERR(HPSSDriverException): code = -623000 + + class HPSS_FILE_READDIR_ERR(HPSSDriverException): code = -624000 + + class HPSS_FILE_STAGE_ERR(HPSSDriverException): code = -625000 + + class HPSS_FILE_GET_FS_FREESPACE_ERR(HPSSDriverException): code = -626000 + + class HPSS_FILE_CHMOD_ERR(HPSSDriverException): code = -627000 + + class HPSS_FILE_RENAME_ERR(HPSSDriverException): code = -628000 + + class HPSS_FILE_TRUNCATE_ERR(HPSSDriverException): code = -629000 + + class HPSS_FILE_LINK_ERR(HPSSDriverException): code = -630000 + + class HPSS_AUTH_ERR(HPSSDriverException): code = -631000 + + class HPSS_WRITE_LIST_ERR(HPSSDriverException): code = -632000 + + class HPSS_READ_LIST_ERR(HPSSDriverException): code = -633000 + + class HPSS_TRANSFER_ERR(HPSSDriverException): code = -634000 + + class HPSS_MOVER_PROT_ERR(HPSSDriverException): code = -635000 + class AmazonS3Exception(FileDriverException): pass + class S3_INIT_ERROR(AmazonS3Exception): code = -701000 + + class S3_PUT_ERROR(AmazonS3Exception): code = -702000 + + class S3_GET_ERROR(AmazonS3Exception): code = -703000 + + class S3_FILE_UNLINK_ERR(AmazonS3Exception): code = -715000 + + class S3_FILE_STAT_ERR(AmazonS3Exception): code = -716000 + + class S3_FILE_COPY_ERR(AmazonS3Exception): code = -717000 + class CatalogLibraryException(iRODSException): pass + class CATALOG_NOT_CONNECTED(CatalogLibraryException): code = -801000 + + class CAT_ENV_ERR(CatalogLibraryException): code = -802000 + + class CAT_CONNECT_ERR(CatalogLibraryException): code = -803000 + + class CAT_DISCONNECT_ERR(CatalogLibraryException): code = -804000 + + class CAT_CLOSE_ENV_ERR(CatalogLibraryException): code = -805000 + + class CAT_SQL_ERR(CatalogLibraryException): code = -806000 + + class CAT_GET_ROW_ERR(CatalogLibraryException): code = -807000 + + class CAT_NO_ROWS_FOUND(CatalogLibraryException): code = -808000 + + class CATALOG_ALREADY_HAS_ITEM_BY_THAT_NAME(CatalogLibraryException): code = -809000 + + class CAT_INVALID_RESOURCE_TYPE(CatalogLibraryException): code = -810000 + + class CAT_INVALID_RESOURCE_CLASS(CatalogLibraryException): code = -811000 + + class CAT_INVALID_RESOURCE_NET_ADDR(CatalogLibraryException): code = -812000 + + class CAT_INVALID_RESOURCE_VAULT_PATH(CatalogLibraryException): code = -813000 + + class CAT_UNKNOWN_COLLECTION(CatalogLibraryException): code = -814000 + + class CAT_INVALID_DATA_TYPE(CatalogLibraryException): code = -815000 + + class CAT_INVALID_ARGUMENT(CatalogLibraryException): code = -816000 + + class CAT_UNKNOWN_FILE(CatalogLibraryException): code = -817000 + + class CAT_NO_ACCESS_PERMISSION(CatalogLibraryException): code = -818000 + + class CAT_SUCCESS_BUT_WITH_NO_INFO(CatalogLibraryException): code = -819000 + + class CAT_INVALID_USER_TYPE(CatalogLibraryException): code = -820000 + + class CAT_COLLECTION_NOT_EMPTY(CatalogLibraryException): code = -821000 + + class CAT_TOO_MANY_TABLES(CatalogLibraryException): code = -822000 + + class CAT_UNKNOWN_TABLE(CatalogLibraryException): code = -823000 + + class CAT_NOT_OPEN(CatalogLibraryException): code = -824000 + + class CAT_FAILED_TO_LINK_TABLES(CatalogLibraryException): code = -825000 + + class CAT_INVALID_AUTHENTICATION(CatalogLibraryException): code = -826000 + + class CAT_INVALID_USER(CatalogLibraryException): code = -827000 + + class CAT_INVALID_ZONE(CatalogLibraryException): code = -828000 + + class CAT_INVALID_GROUP(CatalogLibraryException): code = -829000 + + class CAT_INSUFFICIENT_PRIVILEGE_LEVEL(CatalogLibraryException): code = -830000 + + class CAT_INVALID_RESOURCE(CatalogLibraryException): code = -831000 + + class CAT_INVALID_CLIENT_USER(CatalogLibraryException): code = -832000 + + class CAT_NAME_EXISTS_AS_COLLECTION(CatalogLibraryException): code = -833000 + + class CAT_NAME_EXISTS_AS_DATAOBJ(CatalogLibraryException): code = -834000 + + class CAT_RESOURCE_NOT_EMPTY(CatalogLibraryException): code = -835000 + + class CAT_NOT_A_DATAOBJ_AND_NOT_A_COLLECTION(CatalogLibraryException): code = -836000 + + class CAT_RECURSIVE_MOVE(CatalogLibraryException): code = -837000 + + class CAT_LAST_REPLICA(CatalogLibraryException): code = -838000 + + class CAT_OCI_ERROR(CatalogLibraryException): code = -839000 + + class CAT_PASSWORD_EXPIRED(CatalogLibraryException): code = -840000 + + class CAT_PASSWORD_ENCODING_ERROR(CatalogLibraryException): code = -850000 + + class CAT_TABLE_ACCESS_DENIED(CatalogLibraryException): code = -851000 + class RDSException(iRODSException): pass + class RDA_NOT_COMPILED_IN(RDSException): code = -880000 + + class RDA_NOT_CONNECTED(RDSException): code = -881000 + + class RDA_ENV_ERR(RDSException): code = -882000 + + class RDA_CONNECT_ERR(RDSException): code = -883000 + + class RDA_DISCONNECT_ERR(RDSException): code = -884000 + + class RDA_CLOSE_ENV_ERR(RDSException): code = -885000 + + class RDA_SQL_ERR(RDSException): code = -886000 + + class RDA_CONFIG_FILE_ERR(RDSException): code = -887000 + + class RDA_ACCESS_PROHIBITED(RDSException): code = -888000 + + class RDA_NAME_NOT_FOUND(RDSException): code = -889000 + class MiscException(iRODSException): pass + class FILE_OPEN_ERR(MiscException): code = -900000 + + class FILE_READ_ERR(MiscException): code = -901000 + + class FILE_WRITE_ERR(MiscException): code = -902000 + + class PASSWORD_EXCEEDS_MAX_SIZE(MiscException): code = -903000 + + class ENVIRONMENT_VAR_HOME_NOT_DEFINED(MiscException): code = -904000 + + class UNABLE_TO_STAT_FILE(MiscException): code = -905000 + + class AUTH_FILE_NOT_ENCRYPTED(MiscException): code = -906000 + + class AUTH_FILE_DOES_NOT_EXIST(MiscException): code = -907000 + + class UNLINK_FAILED(MiscException): code = -908000 + + class NO_PASSWORD_ENTERED(MiscException): code = -909000 + + class REMOTE_SERVER_AUTHENTICATION_FAILURE(MiscException): code = -910000 + + class REMOTE_SERVER_AUTH_NOT_PROVIDED(MiscException): code = -911000 + + class REMOTE_SERVER_AUTH_EMPTY(MiscException): code = -912000 + + class REMOTE_SERVER_SID_NOT_DEFINED(MiscException): code = -913000 + class GSIKRBException(iRODSException): pass + class GSIException(GSIKRBException): pass + class GSI_NOT_COMPILED_IN(GSIException): code = -921000 + + class GSI_NOT_BUILT_INTO_CLIENT(GSIException): code = -922000 + + class GSI_NOT_BUILT_INTO_SERVER(GSIException): code = -923000 + + class GSI_ERROR_IMPORT_NAME(GSIException): code = -924000 + + class GSI_ERROR_INIT_SECURITY_CONTEXT(GSIException): code = -925000 + + class GSI_ERROR_SENDING_TOKEN_LENGTH(GSIException): code = -926000 + + class GSI_ERROR_READING_TOKEN_LENGTH(GSIException): code = -927000 + + class GSI_ERROR_TOKEN_TOO_LARGE(GSIException): code = -928000 + + class GSI_ERROR_BAD_TOKEN_RCVED(GSIException): code = -929000 + + class GSI_SOCKET_READ_ERROR(GSIException): code = -930000 + + class GSI_PARTIAL_TOKEN_READ(GSIException): code = -931000 + + class GSI_SOCKET_WRITE_ERROR(GSIException): code = -932000 + + class GSI_ERROR_FROM_GSI_LIBRARY(GSIException): code = -933000 + + class GSI_ERROR_IMPORTING_NAME(GSIException): code = -934000 + + class GSI_ERROR_ACQUIRING_CREDS(GSIException): code = -935000 + + class GSI_ACCEPT_SEC_CONTEXT_ERROR(GSIException): code = -936000 + + class GSI_ERROR_DISPLAYING_NAME(GSIException): code = -937000 + + class GSI_ERROR_RELEASING_NAME(GSIException): code = -938000 + + class GSI_DN_DOES_NOT_MATCH_USER(GSIException): code = -939000 + + class GSI_QUERY_INTERNAL_ERROR(GSIException): code = -940000 + + class GSI_NO_MATCHING_DN_FOUND(GSIException): code = -941000 + + class GSI_MULTIPLE_MATCHING_DN_FOUND(GSIException): code = -942000 + class KRBException(GSIKRBException): pass + class KRB_NOT_COMPILED_IN(KRBException): code = -951000 + + class KRB_NOT_BUILT_INTO_CLIENT(KRBException): code = -952000 + + class KRB_NOT_BUILT_INTO_SERVER(KRBException): code = -953000 + + class KRB_ERROR_IMPORT_NAME(KRBException): code = -954000 + + class KRB_ERROR_INIT_SECURITY_CONTEXT(KRBException): code = -955000 + + class KRB_ERROR_SENDING_TOKEN_LENGTH(KRBException): code = -956000 + + class KRB_ERROR_READING_TOKEN_LENGTH(KRBException): code = -957000 + + class KRB_ERROR_TOKEN_TOO_LARGE(KRBException): code = -958000 + + class KRB_ERROR_BAD_TOKEN_RCVED(KRBException): code = -959000 + + class KRB_SOCKET_READ_ERROR(KRBException): code = -960000 + + class KRB_PARTIAL_TOKEN_READ(KRBException): code = -961000 + + class KRB_SOCKET_WRITE_ERROR(KRBException): code = -962000 + + class KRB_ERROR_FROM_KRB_LIBRARY(KRBException): code = -963000 + + class KRB_ERROR_IMPORTING_NAME(KRBException): code = -964000 + + class KRB_ERROR_ACQUIRING_CREDS(KRBException): code = -965000 + + class KRB_ACCEPT_SEC_CONTEXT_ERROR(KRBException): code = -966000 + + class KRB_ERROR_DISPLAYING_NAME(KRBException): code = -967000 + + class KRB_ERROR_RELEASING_NAME(KRBException): code = -968000 + + class KRB_USER_DN_NOT_FOUND(KRBException): code = -969000 + + class KRB_NAME_MATCHES_MULTIPLE_USERS(KRBException): code = -970000 + + class KRB_QUERY_INTERNAL_ERROR(KRBException): code = -971000 + class RuleEngineException(iRODSException): pass + class OBJPATH_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1000000 + + class RESCNAME_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1001000 + + class DATATYPE_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1002000 + + class DATASIZE_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1003000 + + class CHKSUM_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1004000 + + class VERSION_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1005000 + + class FILEPATH_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1006000 + + class REPLNUM_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1007000 + + class REPLSTATUS_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1008000 + + class DATAOWNER_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1009000 + + class DATAOWNERZONE_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1010000 + + class DATAEXPIRY_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1011000 + + class DATACOMMENTS_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1012000 + + class DATACREATE_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1013000 + + class DATAMODIFY_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1014000 + + class DATAACCESS_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1015000 + + class DATAACCESSINX_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1016000 + + class NO_RULE_FOUND_ERR(RuleEngineException): code = -1017000 + + class NO_MORE_RULES_ERR(RuleEngineException): code = -1018000 + + class UNMATCHED_ACTION_ERR(RuleEngineException): code = -1019000 + + class RULES_FILE_READ_ERROR(RuleEngineException): code = -1020000 + + class ACTION_ARG_COUNT_MISMATCH(RuleEngineException): code = -1021000 + + class MAX_NUM_OF_ARGS_IN_ACTION_EXCEEDED(RuleEngineException): code = -1022000 + + class UNKNOWN_PARAM_IN_RULE_ERR(RuleEngineException): code = -1023000 + + class DESTRESCNAME_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1024000 + + class BACKUPRESCNAME_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1025000 + + class DATAID_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1026000 + + class COLLID_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1027000 + + class RESCGROUPNAME_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1028000 + + class STATUSSTRING_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1029000 + + class DATAMAPID_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1030000 + + class USERNAMECLIENT_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1031000 + + class RODSZONECLIENT_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1032000 + + class USERTYPECLIENT_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1033000 + + class HOSTCLIENT_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1034000 + + class AUTHSTRCLIENT_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1035000 + + class USERAUTHSCHEMECLIENT_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1036000 + + class USERINFOCLIENT_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1037000 + + class USERCOMMENTCLIENT_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1038000 + + class USERCREATECLIENT_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1039000 + + class USERMODIFYCLIENT_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1040000 + + class USERNAMEPROXY_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1041000 + + class RODSZONEPROXY_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1042000 + + class USERTYPEPROXY_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1043000 + + class HOSTPROXY_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1044000 + + class AUTHSTRPROXY_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1045000 + + class USERAUTHSCHEMEPROXY_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1046000 + + class USERINFOPROXY_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1047000 + + class USERCOMMENTPROXY_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1048000 + + class USERCREATEPROXY_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1049000 + + class USERMODIFYPROXY_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1050000 + + class COLLNAME_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1051000 + + class COLLPARENTNAME_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1052000 + + class COLLOWNERNAME_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1053000 + + class COLLOWNERZONE_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1054000 + + class COLLEXPIRY_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1055000 + + class COLLCOMMENTS_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1056000 + + class COLLCREATE_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1057000 + + class COLLMODIFY_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1058000 + + class COLLACCESS_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1059000 + + class COLLACCESSINX_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1060000 + + class COLLMAPID_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1062000 + + class COLLINHERITANCE_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1063000 + + class RESCZONE_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1065000 + + class RESCLOC_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1066000 + + class RESCTYPE_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1067000 + + class RESCTYPEINX_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1068000 + + class RESCCLASS_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1069000 + + class RESCCLASSINX_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1070000 + + class RESCVAULTPATH_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1071000 + + class NUMOPEN_ORTS_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1072000 + + class PARAOPR_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1073000 + + class RESCID_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1074000 + + class GATEWAYADDR_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1075000 + + class RESCMAX_BJSIZE_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1076000 + + class FREESPACE_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1077000 + + class FREESPACETIME_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1078000 + + class FREESPACETIMESTAMP_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1079000 + + class RESCINFO_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1080000 + + class RESCCOMMENTS_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1081000 + + class RESCCREATE_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1082000 + + class RESCMODIFY_EMPTY_IN_STRUCT_ERR(RuleEngineException): code = -1083000 + + class INPUT_ARG_NOT_WELL_FORMED_ERR(RuleEngineException): code = -1084000 + + class INPUT_ARG_OUT_OF_ARGC_RANGE_ERR(RuleEngineException): code = -1085000 + + class INSUFFICIENT_INPUT_ARG_ERR(RuleEngineException): code = -1086000 + + class INPUT_ARG_DOES_NOT_MATCH_ERR(RuleEngineException): code = -1087000 + + class RETRY_WITHOUT_RECOVERY_ERR(RuleEngineException): code = -1088000 + + class CUT_ACTION_PROCESSED_ERR(RuleEngineException): code = -1089000 + + class ACTION_FAILED_ERR(RuleEngineException): code = -1090000 + + class FAIL_ACTION_ENCOUNTERED_ERR(RuleEngineException): code = -1091000 + + class VARIABLE_NAME_TOO_LONG_ERR(RuleEngineException): code = -1092000 + + class UNKNOWN_VARIABLE_MAP_ERR(RuleEngineException): code = -1093000 + + class UNDEFINED_VARIABLE_MAP_ERR(RuleEngineException): code = -1094000 + + class NULL_VALUE_ERR(RuleEngineException): code = -1095000 + + class DVARMAP_FILE_READ_ERROR(RuleEngineException): code = -1096000 + + class NO_RULE_OR_MSI_FUNCTION_FOUND_ERR(RuleEngineException): code = -1097000 + + class FILE_CREATE_ERROR(RuleEngineException): code = -1098000 + + class FMAP_FILE_READ_ERROR(RuleEngineException): code = -1099000 + + class DATE_FORMAT_ERR(RuleEngineException): code = -1100000 + + class RULE_FAILED_ERR(RuleEngineException): code = -1101000 + + class NO_MICROSERVICE_FOUND_ERR(RuleEngineException): code = -1102000 + + class INVALID_REGEXP(RuleEngineException): code = -1103000 + + class INVALID_OBJECT_NAME(RuleEngineException): code = -1104000 + + class INVALID_OBJECT_TYPE(RuleEngineException): code = -1105000 + + class NO_VALUES_FOUND(RuleEngineException): code = -1106000 + + class NO_COLUMN_NAME_FOUND(RuleEngineException): code = -1107000 + + class BREAK_ACTION_ENCOUNTERED_ERR(RuleEngineException): code = -1108000 + + class CUT_ACTION_ON_SUCCESS_PROCESSED_ERR(RuleEngineException): code = -1109000 + + class MSI_OPERATION_NOT_ALLOWED(RuleEngineException): code = -1110000 + class PHPException(iRODSException): pass + class PHP_EXEC_SCRIPT_ERR(PHPException): code = -1600000 + + class PHP_REQUEST_STARTUP_ERR(PHPException): code = -1601000 + + class PHP_OPEN_SCRIPT_FILE_ERR(PHPException): - code = -1602000 + code = -1602000 diff --git a/irods/keywords.py b/irods/keywords.py index 12ee903b04..b9877e66b3 100644 --- a/irods/keywords.py +++ b/irods/keywords.py @@ -1,272 +1,269 @@ '''From rodsKeyWdDef.hpp ''' -ALL_KW = "all" # operation done on all replica # -COPIES_KW = "copies" # the number of copies # -EXEC_LOCALLY_KW = "execLocally" # execute locally # -FORCE_FLAG_KW = "forceFlag" # force update # -CLI_IN_SVR_FIREWALL_KW = "cliInSvrFirewall"# cli behind same firewall # -REG_CHKSUM_KW = "regChksum" # register checksum # -VERIFY_CHKSUM_KW = "verifyChksum" # verify checksum # -VERIFY_BY_SIZE_KW = "verifyBySize"# verify by size - used by irsync # -OBJ_PATH_KW = "objPath" # logical path of the object # -RESC_NAME_KW = "rescName" # resource name # -DEST_RESC_NAME_KW = "destRescName" # destination resource name # -DEF_RESC_NAME_KW = "defRescName" # default resource name # -BACKUP_RESC_NAME_KW = "backupRescName"# destination resource name # -DATA_TYPE_KW = "dataType" # data type # -DATA_SIZE_KW = "dataSize" -CHKSUM_KW = "chksum" -ORIG_CHKSUM_KW = "orig_chksum" -VERSION_KW = "version" -FILE_PATH_KW = "filePath" # the physical file path # -BUN_FILE_PATH_KW = "bunFilePath"# the physical bun file path # # JMC - backport 4768 -REPL_NUM_KW = "replNum" # replica number # -WRITE_FLAG_KW = "writeFlag" # whether it is opened for write # -REPL_STATUS_KW = "replStatus" # status of the replica # -ALL_REPL_STATUS_KW = "allReplStatus" # update all replStatus # -DATA_INCLUDED_KW = "dataIncluded" # data included in the input buffer # -DATA_OWNER_KW = "dataOwner" -DATA_OWNER_ZONE_KW = "dataOwnerZone" -DATA_EXPIRY_KW = "dataExpiry" -DATA_COMMENTS_KW = "dataComments" -DATA_CREATE_KW = "dataCreate" -DATA_MODIFY_KW = "dataModify" -DATA_ACCESS_KW = "dataAccess" -DATA_ACCESS_INX_KW = "dataAccessInx" -NO_OPEN_FLAG_KW = "noOpenFlag" -PHYOPEN_BY_SIZE_KW = "phyOpenBySize" -STREAMING_KW = "streaming" -DATA_ID_KW = "dataId" -COLL_ID_KW = "collId" -DATA_MODE_KW = "dataMode" -STATUS_STRING_KW = "statusString" -DATA_MAP_ID_KW = "dataMapId" -NO_PARA_OP_KW = "noParaOpr" -LOCAL_PATH_KW = "localPath" -RSYNC_MODE_KW = "rsyncMode" -RSYNC_DEST_PATH_KW = "rsyncDestPath" -RSYNC_CHKSUM_KW = "rsyncChksum" -CHKSUM_ALL_KW = "ChksumAll" -FORCE_CHKSUM_KW = "forceChksum" -COLLECTION_KW = "collection" -ADMIN_KW = "irodsAdmin" -ADMIN_RMTRASH_KW = "irodsAdminRmTrash" -UNREG_KW = "unreg" -RMTRASH_KW = "irodsRmTrash" -RECURSIVE_OPR__KW = "recursiveOpr" -COLLECTION_TYPE_KW = "collectionType" -COLLECTION_INFO1_KW = "collectionInfo1" -COLLECTION_INFO2_KW = "collectionInfo2" -SEL_OBJ_TYPE_KW = "selObjType" -STRUCT_FILE_OPR_KW = "structFileOpr" -ALL_MS_PARAM_KW = "allMsParam" -UNREG_COLL_KW = "unregColl" -UPDATE_REPL_KW = "updateRepl" -RBUDP_TRANSFER_KW = "rbudpTransfer" -VERY_VERBOSE_KW = "veryVerbose" -RBUDP_SEND_RATE_KW = "rbudpSendRate" -RBUDP_PACK_SIZE_KW = "rbudpPackSize" -ZONE_KW = "zone" -REMOTE_ZONE_OPR_KW = "remoteZoneOpr" -REPL_DATA_OBJ_INP_KW = "replDataObjInp" -CROSS_ZONE_CREATE_KW = "replDataObjInp" # use the same for backward compatibility # -QUERY_BY_DATA_ID_KW = "queryByDataID" -SU_CLIENT_USER_KW = "suClientUser" -RM_BUN_COPY_KW = "rmBunCopy" -KEY_WORD_KW = "keyWord" # the msKeyValStr is a keyword # -CREATE_MODE_KW = "createMode"# a msKeyValStr keyword # -OPEN_FLAGS_KW = "openFlags"# a msKeyValStr keyword # -OFFSET_KW = "offset"# a msKeyValStr keyword # +ALL_KW = "all" # operation done on all replica # +COPIES_KW = "copies" # the number of copies # +EXEC_LOCALLY_KW = "execLocally" # execute locally # +FORCE_FLAG_KW = "forceFlag" # force update # +CLI_IN_SVR_FIREWALL_KW = "cliInSvrFirewall" # cli behind same firewall # +REG_CHKSUM_KW = "regChksum" # register checksum # +VERIFY_CHKSUM_KW = "verifyChksum" # verify checksum # +VERIFY_BY_SIZE_KW = "verifyBySize" # verify by size - used by irsync # +OBJ_PATH_KW = "objPath" # logical path of the object # +RESC_NAME_KW = "rescName" # resource name # +DEST_RESC_NAME_KW = "destRescName" # destination resource name # +DEF_RESC_NAME_KW = "defRescName" # default resource name # +BACKUP_RESC_NAME_KW = "backupRescName" # destination resource name # +DATA_TYPE_KW = "dataType" # data type # +DATA_SIZE_KW = "dataSize" +CHKSUM_KW = "chksum" +ORIG_CHKSUM_KW = "orig_chksum" +VERSION_KW = "version" +FILE_PATH_KW = "filePath" # the physical file path # +BUN_FILE_PATH_KW = "bunFilePath" # the physical bun file path # # JMC - backport 4768 +REPL_NUM_KW = "replNum" # replica number # +WRITE_FLAG_KW = "writeFlag" # whether it is opened for write # +REPL_STATUS_KW = "replStatus" # status of the replica # +ALL_REPL_STATUS_KW = "allReplStatus" # update all replStatus # +DATA_INCLUDED_KW = "dataIncluded" # data included in the input buffer # +DATA_OWNER_KW = "dataOwner" +DATA_OWNER_ZONE_KW = "dataOwnerZone" +DATA_EXPIRY_KW = "dataExpiry" +DATA_COMMENTS_KW = "dataComments" +DATA_CREATE_KW = "dataCreate" +DATA_MODIFY_KW = "dataModify" +DATA_ACCESS_KW = "dataAccess" +DATA_ACCESS_INX_KW = "dataAccessInx" +NO_OPEN_FLAG_KW = "noOpenFlag" +PHYOPEN_BY_SIZE_KW = "phyOpenBySize" +STREAMING_KW = "streaming" +DATA_ID_KW = "dataId" +COLL_ID_KW = "collId" +DATA_MODE_KW = "dataMode" +STATUS_STRING_KW = "statusString" +DATA_MAP_ID_KW = "dataMapId" +NO_PARA_OP_KW = "noParaOpr" +LOCAL_PATH_KW = "localPath" +RSYNC_MODE_KW = "rsyncMode" +RSYNC_DEST_PATH_KW = "rsyncDestPath" +RSYNC_CHKSUM_KW = "rsyncChksum" +CHKSUM_ALL_KW = "ChksumAll" +FORCE_CHKSUM_KW = "forceChksum" +COLLECTION_KW = "collection" +ADMIN_KW = "irodsAdmin" +ADMIN_RMTRASH_KW = "irodsAdminRmTrash" +UNREG_KW = "unreg" +RMTRASH_KW = "irodsRmTrash" +RECURSIVE_OPR__KW = "recursiveOpr" +COLLECTION_TYPE_KW = "collectionType" +COLLECTION_INFO1_KW = "collectionInfo1" +COLLECTION_INFO2_KW = "collectionInfo2" +SEL_OBJ_TYPE_KW = "selObjType" +STRUCT_FILE_OPR_KW = "structFileOpr" +ALL_MS_PARAM_KW = "allMsParam" +UNREG_COLL_KW = "unregColl" +UPDATE_REPL_KW = "updateRepl" +RBUDP_TRANSFER_KW = "rbudpTransfer" +VERY_VERBOSE_KW = "veryVerbose" +RBUDP_SEND_RATE_KW = "rbudpSendRate" +RBUDP_PACK_SIZE_KW = "rbudpPackSize" +ZONE_KW = "zone" +REMOTE_ZONE_OPR_KW = "remoteZoneOpr" +REPL_DATA_OBJ_INP_KW = "replDataObjInp" +CROSS_ZONE_CREATE_KW = "replDataObjInp" # use the same for backward compatibility # +QUERY_BY_DATA_ID_KW = "queryByDataID" +SU_CLIENT_USER_KW = "suClientUser" +RM_BUN_COPY_KW = "rmBunCopy" +KEY_WORD_KW = "keyWord" # the msKeyValStr is a keyword # +CREATE_MODE_KW = "createMode" # a msKeyValStr keyword # +OPEN_FLAGS_KW = "openFlags" # a msKeyValStr keyword # +OFFSET_KW = "offset" # a msKeyValStr keyword # # DATA_SIZE_KW already defined # -NUM_THREADS_KW = "numThreads"# a msKeyValStr keyword # -OPR_TYPE_KW = "oprType"# a msKeyValStr keyword # -COLL_FLAGS_KW = "collFlags"# a msKeyValStr keyword # -TRANSLATED_PATH_KW = "translatedPath" # the path translated # -NO_TRANSLATE_LINKPT_KW = "noTranslateMntpt" # don't translate mntpt # -BULK_OPR_KW = "bulkOpr" # the bulk operation # -NON_BULK_OPR_KW = "nonBulkOpr" # non bulk operation # -EXEC_CMD_RULE_KW = "execCmdRule"# the rule that invoke execCmd # -EXEC_MY_RULE_KW = "execMyRule"# the rule is invoked by rsExecMyRule # -STREAM_STDOUT_KW = "streamStdout" # the stream stdout for execCmd # -REG_REPL_KW = "regRepl" # register replica # -AGE_KW = "age" # age of the file for itrim # -DRYRUN_KW = "dryrun" # do a dry run # -ACL_COLLECTION_KW = "aclCollection" # the collection from which the ACL should be used # -NO_CHK_COPY_LEN_KW = "noChkCopyLen" # Don't check the len when transfering # -TICKET_KW = "ticket" # for ticket-based-access # -PURGE_CACHE_KW = "purgeCache" # purge the cache copy right after the operation JMC - backport 4537 -EMPTY_BUNDLE_ONLY_KW = "emptyBundleOnly"# delete emptyBundleOnly # # JMC - backport 4552 +NUM_THREADS_KW = "numThreads" # a msKeyValStr keyword # +OPR_TYPE_KW = "oprType" # a msKeyValStr keyword # +COLL_FLAGS_KW = "collFlags" # a msKeyValStr keyword # +TRANSLATED_PATH_KW = "translatedPath" # the path translated # +NO_TRANSLATE_LINKPT_KW = "noTranslateMntpt" # don't translate mntpt # +BULK_OPR_KW = "bulkOpr" # the bulk operation # +NON_BULK_OPR_KW = "nonBulkOpr" # non bulk operation # +EXEC_CMD_RULE_KW = "execCmdRule" # the rule that invoke execCmd # +EXEC_MY_RULE_KW = "execMyRule" # the rule is invoked by rsExecMyRule # +STREAM_STDOUT_KW = "streamStdout" # the stream stdout for execCmd # +REG_REPL_KW = "regRepl" # register replica # +AGE_KW = "age" # age of the file for itrim # +DRYRUN_KW = "dryrun" # do a dry run # +ACL_COLLECTION_KW = "aclCollection" # the collection from which the ACL should be used # +NO_CHK_COPY_LEN_KW = "noChkCopyLen" # Don't check the len when transfering # +TICKET_KW = "ticket" # for ticket-based-access # +PURGE_CACHE_KW = "purgeCache" # purge the cache copy right after the operation JMC - backport 4537 +EMPTY_BUNDLE_ONLY_KW = "emptyBundleOnly" # delete emptyBundleOnly # # JMC - backport 4552 # =-=-=-=-=-=-=- # JMC - backport 4599 -LOCK_TYPE_KW = "lockType" # valid values are READ_LOCK_TYPE, WRITE_LOCK_TYPE and UNLOCK_TYPE # -LOCK_CMD_KW = "lockCmd" # valid values are SET_LOCK_WAIT_CMD, SET_LOCK_CMD and GET_LOCK_CMD # -LOCK_FD_KW = "lockFd" # Lock file desc for unlock # -MAX_SUB_FILE_KW = "maxSubFile"# max number of files for tar file bundles # -MAX_BUNDLE_SIZE_KW = "maxBunSize"# max size of a tar bundle in Gbs # -NO_STAGING_KW = "noStaging" +LOCK_TYPE_KW = "lockType" # valid values are READ_LOCK_TYPE, WRITE_LOCK_TYPE and UNLOCK_TYPE # +LOCK_CMD_KW = "lockCmd" # valid values are SET_LOCK_WAIT_CMD, SET_LOCK_CMD and GET_LOCK_CMD # +LOCK_FD_KW = "lockFd" # Lock file desc for unlock # +MAX_SUB_FILE_KW = "maxSubFile" # max number of files for tar file bundles # +MAX_BUNDLE_SIZE_KW = "maxBunSize" # max size of a tar bundle in Gbs # +NO_STAGING_KW = "noStaging" # =-=-=-=-=-=-=- -MAX_SUB_FILE_KW = "maxSubFile"# max number of files for tar file bundles # # JMC - backport 4771 +MAX_SUB_FILE_KW = "maxSubFile" # max number of files for tar file bundles # # JMC - backport 4771 # OBJ_PATH_KW already defined # # OBJ_PATH_KW already defined # # COLL_NAME_KW already defined # -FILE_UID_KW = "fileUid" -FILE_OWNER_KW = "fileOwner" -FILE_GID_KW = "fileGid" -FILE_GROUP_KW = "fileGroup" -FILE_MODE_KW = "fileMode" -FILE_CTIME_KW = "fileCtime" -FILE_MTIME_KW = "fileMtime" -FILE_SOURCE_PATH_KW = "fileSourcePath" -EXCLUDE_FILE_KW = "excludeFile" +FILE_UID_KW = "fileUid" +FILE_OWNER_KW = "fileOwner" +FILE_GID_KW = "fileGid" +FILE_GROUP_KW = "fileGroup" +FILE_MODE_KW = "fileMode" +FILE_CTIME_KW = "fileCtime" +FILE_MTIME_KW = "fileMtime" +FILE_SOURCE_PATH_KW = "fileSourcePath" +EXCLUDE_FILE_KW = "excludeFile" # The following are the keyWord definition for the rescCond key/value pair # # RESC_NAME_KW is defined above # -RESC_ZONE_KW = "zoneName" -RESC_LOC_KW = "rescLoc" # resc_net in DB # -RESC_TYPE_KW = "rescType" -RESC_CLASS_KW = "rescClass" -RESC_VAULT_PATH_KW = "rescVaultPath"# resc_def_path in DB # -RESC_STATUS_KW = "rescStatus" -GATEWAY_ADDR_KW = "gateWayAddr" -RESC_MAX_OBJ_SIZE_KW = "rescMaxObjSize" -FREE_SPACE_KW = "freeSpace" -FREE_SPACE_TIME_KW = "freeSpaceTime" -FREE_SPACE_TIMESTAMP_KW = "freeSpaceTimeStamp" -RESC_TYPE_INX_KW = "rescTypeInx" -RESC_CLASS_INX_KW = "rescClassInx" -RESC_ID_KW = "rescId" -RESC_COMMENTS_KW = "rescComments" -RESC_CREATE_KW = "rescCreate" -RESC_MODIFY_KW = "rescModify" +RESC_ZONE_KW = "zoneName" +RESC_LOC_KW = "rescLoc" # resc_net in DB # +RESC_TYPE_KW = "rescType" +RESC_CLASS_KW = "rescClass" +RESC_VAULT_PATH_KW = "rescVaultPath" # resc_def_path in DB # +RESC_STATUS_KW = "rescStatus" +GATEWAY_ADDR_KW = "gateWayAddr" +RESC_MAX_OBJ_SIZE_KW = "rescMaxObjSize" +FREE_SPACE_KW = "freeSpace" +FREE_SPACE_TIME_KW = "freeSpaceTime" +FREE_SPACE_TIMESTAMP_KW = "freeSpaceTimeStamp" +RESC_TYPE_INX_KW = "rescTypeInx" +RESC_CLASS_INX_KW = "rescClassInx" +RESC_ID_KW = "rescId" +RESC_COMMENTS_KW = "rescComments" +RESC_CREATE_KW = "rescCreate" +RESC_MODIFY_KW = "rescModify" # The following are the keyWord definition for the userCond key/value pair # -USER_NAME_CLIENT_KW = "userNameClient" -RODS_ZONE_CLIENT_KW = "rodsZoneClient" -HOST_CLIENT_KW = "hostClient" -CLIENT_ADDR_KW = "clientAddr" -USER_TYPE_CLIENT_KW = "userTypeClient" -AUTH_STR_CLIENT_KW = "authStrClient"# user distin name # -USER_AUTH_SCHEME_CLIENT_KW = "userAuthSchemeClient" -USER_INFO_CLIENT_KW = "userInfoClient" -USER_COMMENT_CLIENT_KW = "userCommentClient" -USER_CREATE_CLIENT_KW = "userCreateClient" -USER_MODIFY_CLIENT_KW = "userModifyClient" -USER_NAME_PROXY_KW = "userNameProxy" -RODS_ZONE_PROXY_KW = "rodsZoneProxy" -HOST_PROXY_KW = "hostProxy" -USER_TYPE_PROXY_KW = "userTypeProxy" -AUTH_STR_PROXY_KW = "authStrProxy"# dn # -USER_AUTH_SCHEME_PROXY_KW = "userAuthSchemeProxy" -USER_INFO_PROXY_KW = "userInfoProxy" -USER_COMMENT_PROXY_KW = "userCommentProxy" -USER_CREATE_PROXY_KW = "userCreateProxy" -USER_MODIFY_PROXY_KW = "userModifyProxy" -ACCESS_PERMISSION_KW = "accessPermission" -NO_CHK_FILE_PERM_KW = "noChkFilePerm" +USER_NAME_CLIENT_KW = "userNameClient" +RODS_ZONE_CLIENT_KW = "rodsZoneClient" +HOST_CLIENT_KW = "hostClient" +CLIENT_ADDR_KW = "clientAddr" +USER_TYPE_CLIENT_KW = "userTypeClient" +AUTH_STR_CLIENT_KW = "authStrClient" # user distin name # +USER_AUTH_SCHEME_CLIENT_KW = "userAuthSchemeClient" +USER_INFO_CLIENT_KW = "userInfoClient" +USER_COMMENT_CLIENT_KW = "userCommentClient" +USER_CREATE_CLIENT_KW = "userCreateClient" +USER_MODIFY_CLIENT_KW = "userModifyClient" +USER_NAME_PROXY_KW = "userNameProxy" +RODS_ZONE_PROXY_KW = "rodsZoneProxy" +HOST_PROXY_KW = "hostProxy" +USER_TYPE_PROXY_KW = "userTypeProxy" +AUTH_STR_PROXY_KW = "authStrProxy" # dn # +USER_AUTH_SCHEME_PROXY_KW = "userAuthSchemeProxy" +USER_INFO_PROXY_KW = "userInfoProxy" +USER_COMMENT_PROXY_KW = "userCommentProxy" +USER_CREATE_PROXY_KW = "userCreateProxy" +USER_MODIFY_PROXY_KW = "userModifyProxy" +ACCESS_PERMISSION_KW = "accessPermission" +NO_CHK_FILE_PERM_KW = "noChkFilePerm" # The following are the keyWord definition for the collCond key/value pair # -COLL_NAME_KW = "collName" -COLL_PARENT_NAME_KW = "collParentName"# parent_coll_name in DB # -COLL_OWNER_NAME_KW = "collOwnername" -COLL_OWNER_ZONE_KW = "collOwnerZone" -COLL_MAP_ID_KW = "collMapId" -COLL_INHERITANCE_KW = "collInheritance" -COLL_COMMENTS_KW = "collComments" -COLL_EXPIRY_KW = "collExpiry" -COLL_CREATE_KW = "collCreate" -COLL_MODIFY_KW = "collModify" -COLL_ACCESS_KW = "collAccess" -COLL_ACCESS_INX_KW = "collAccessInx" -COLL_ID_KW = "collId" +COLL_NAME_KW = "collName" +COLL_PARENT_NAME_KW = "collParentName" # parent_coll_name in DB # +COLL_OWNER_NAME_KW = "collOwnername" +COLL_OWNER_ZONE_KW = "collOwnerZone" +COLL_MAP_ID_KW = "collMapId" +COLL_INHERITANCE_KW = "collInheritance" +COLL_COMMENTS_KW = "collComments" +COLL_EXPIRY_KW = "collExpiry" +COLL_CREATE_KW = "collCreate" +COLL_MODIFY_KW = "collModify" +COLL_ACCESS_KW = "collAccess" +COLL_ACCESS_INX_KW = "collAccessInx" +COLL_ID_KW = "collId" # The following are the keyWord definitions for the keyValPair_t input to chlModRuleExec. # -RULE_NAME_KW = "ruleName" -RULE_REI_FILE_PATH_KW = "reiFilePath" -RULE_USER_NAME_KW = "userName" -RULE_EXE_ADDRESS_KW = "exeAddress" -RULE_EXE_TIME_KW = "exeTime" -RULE_EXE_FREQUENCY_KW = "exeFrequency" -RULE_PRIORITY_KW = "priority" -RULE_ESTIMATE_EXE_TIME_KW = "estimateExeTime" -RULE_NOTIFICATION_ADDR_KW = "notificationAddr" -RULE_LAST_EXE_TIME_KW = "lastExeTime" -RULE_EXE_STATUS_KW = "exeStatus" +RULE_NAME_KW = "ruleName" +RULE_REI_FILE_PATH_KW = "reiFilePath" +RULE_USER_NAME_KW = "userName" +RULE_EXE_ADDRESS_KW = "exeAddress" +RULE_EXE_TIME_KW = "exeTime" +RULE_EXE_FREQUENCY_KW = "exeFrequency" +RULE_PRIORITY_KW = "priority" +RULE_ESTIMATE_EXE_TIME_KW = "estimateExeTime" +RULE_NOTIFICATION_ADDR_KW = "notificationAddr" +RULE_LAST_EXE_TIME_KW = "lastExeTime" +RULE_EXE_STATUS_KW = "exeStatus" -EXCLUDE_FILE_KW = "excludeFile" -AGE_KW = "age" # age of the file for itrim # +EXCLUDE_FILE_KW = "excludeFile" +AGE_KW = "age" # age of the file for itrim # # =-=-=-=-=-=-=- # irods general keywords definitions -RESC_HIER_STR_KW = "resc_hier" -DEST_RESC_HIER_STR_KW = "dest_resc_hier" -IN_PDMO_KW = "in_pdmo" -STAGE_OBJ_KW = "stage_object" -SYNC_OBJ_KW = "sync_object" -IN_REPL_KW = "in_repl" +RESC_HIER_STR_KW = "resc_hier" +DEST_RESC_HIER_STR_KW = "dest_resc_hier" +IN_PDMO_KW = "in_pdmo" +STAGE_OBJ_KW = "stage_object" +SYNC_OBJ_KW = "sync_object" +IN_REPL_KW = "in_repl" # =-=-=-=-=-=-=- # irods tcp keyword definitions -SOCKET_HANDLE_KW = "tcp_socket_handle" +SOCKET_HANDLE_KW = "tcp_socket_handle" # =-=-=-=-=-=-=- # irods ssl keyword definitions -SSL_HOST_KW = "ssl_host" -SSL_SHARED_SECRET_KW = "ssl_shared_secret" -SSL_KEY_SIZE_KW = "ssl_key_size" -SSL_SALT_SIZE_KW = "ssl_salt_size" -SSL_NUM_HASH_ROUNDS_KW = "ssl_num_hash_rounds" -SSL_ALGORITHM_KW = "ssl_algorithm" +SSL_HOST_KW = "ssl_host" +SSL_SHARED_SECRET_KW = "ssl_shared_secret" +SSL_KEY_SIZE_KW = "ssl_key_size" +SSL_SALT_SIZE_KW = "ssl_salt_size" +SSL_NUM_HASH_ROUNDS_KW = "ssl_num_hash_rounds" +SSL_ALGORITHM_KW = "ssl_algorithm" # =-=-=-=-=-=-=- # irods data_object keyword definitions -PHYSICAL_PATH_KW = "physical_path" -MODE_KW = "mode_kw" -FLAGS_KW = "flags_kw" +PHYSICAL_PATH_KW = "physical_path" +MODE_KW = "mode_kw" +FLAGS_KW = "flags_kw" # borrowed RESC_HIER_STR_KW # =-=-=-=-=-=-=- # irods file_object keyword definitions -LOGICAL_PATH_KW = "logical_path" -FILE_DESCRIPTOR_KW = "file_descriptor" -L1_DESC_IDX_KW = "l1_desc_idx" -SIZE_KW = "file_size" -REPL_REQUESTED_KW = "repl_requested" +LOGICAL_PATH_KW = "logical_path" +FILE_DESCRIPTOR_KW = "file_descriptor" +L1_DESC_IDX_KW = "l1_desc_idx" +SIZE_KW = "file_size" +REPL_REQUESTED_KW = "repl_requested" # borrowed IN_PDMO_KW # =-=-=-=-=-=-=- # irods structured_object keyword definitions -HOST_ADDR_KW = "host_addr" -ZONE_NAME_KW = "zone_name" -PORT_NUM_KW = "port_num" -SUB_FILE_PATH_KW = "sub_file_path" +HOST_ADDR_KW = "host_addr" +ZONE_NAME_KW = "zone_name" +PORT_NUM_KW = "port_num" +SUB_FILE_PATH_KW = "sub_file_path" # borrowed OFFSET_KW # borrowed DATA_TYPE_KW # borrowed OPR_TYPE_KW # =-=-=-=-=-=-=- # irods spec coll keyword definitions -SPEC_COLL_CLASS_KW = "spec_coll_class" -SPEC_COLL_TYPE_KW = "spec_coll_type" -SPEC_COLL_OBJ_PATH_KW = "spec_coll_obj_path" -SPEC_COLL_RESOURCE_KW = "spec_coll_resource" -SPEC_COLL_RESC_HIER_KW = "spec_coll_resc_hier" -SPEC_COLL_PHY_PATH_KW = "spec_coll_phy_path" -SPEC_COLL_CACHE_DIR_KW = "spec_coll_cache_dir" -SPEC_COLL_CACHE_DIRTY = "spec_coll_cache_dirty" -SPEC_COLL_REPL_NUM = "spec_coll_repl_num" - - -DISABLE_STRICT_ACL_KW = "disable_strict_acls" - +SPEC_COLL_CLASS_KW = "spec_coll_class" +SPEC_COLL_TYPE_KW = "spec_coll_type" +SPEC_COLL_OBJ_PATH_KW = "spec_coll_obj_path" +SPEC_COLL_RESOURCE_KW = "spec_coll_resource" +SPEC_COLL_RESC_HIER_KW = "spec_coll_resc_hier" +SPEC_COLL_PHY_PATH_KW = "spec_coll_phy_path" +SPEC_COLL_CACHE_DIR_KW = "spec_coll_cache_dir" +SPEC_COLL_CACHE_DIRTY = "spec_coll_cache_dirty" +SPEC_COLL_REPL_NUM = "spec_coll_repl_num" +DISABLE_STRICT_ACL_KW = "disable_strict_acls" diff --git a/irods/manager/__init__.py b/irods/manager/__init__.py index 67e393386e..9ad1dcf0b1 100644 --- a/irods/manager/__init__.py +++ b/irods/manager/__init__.py @@ -1,3 +1,4 @@ class Manager(object): + def __init__(self, sess): self.sess = sess diff --git a/irods/manager/collection_manager.py b/irods/manager/collection_manager.py index 897caf0962..2452edb838 100644 --- a/irods/manager/collection_manager.py +++ b/irods/manager/collection_manager.py @@ -8,6 +8,7 @@ class CollectionManager(Manager): + def get(self, path): query = self.sess.query(Collection).filter(Collection.name == path) try: @@ -15,14 +16,14 @@ def get(self, path): except NoResultFound: raise CollectionDoesNotExist() return iRODSCollection(self, result) - + def create(self, path): message_body = CollectionRequest( collName=path, KeyValPair_PI=StringStringMap() ) - message = iRODSMessage('RODS_API_REQ', msg=message_body, - int_info=api_number['COLL_CREATE_AN']) + message = iRODSMessage('RODS_API_REQ', msg=message_body, + int_info=api_number['COLL_CREATE_AN']) with self.sess.pool.get_connection() as conn: conn.send(message) response = conn.recv() @@ -40,11 +41,11 @@ def remove(self, path, recurse=True, force=False, additional_flags={}): KeyValPair_PI=StringStringMap(options) ) message = iRODSMessage('RODS_API_REQ', msg=message_body, - int_info=api_number['RM_COLL_AN']) + int_info=api_number['RM_COLL_AN']) with self.sess.pool.get_connection() as conn: conn.send(message) response = conn.recv() - + while response.int_info == SYS_SVR_TO_CLI_COLL_STAT: conn.reply(SYS_CLI_TO_SVR_COLL_STAT_REPLY) response = conn.recv() @@ -60,7 +61,7 @@ def move(self, src_path, dest_path): # check if dest is an existing collection # if so append collection name to it if self.sess.collections.exists(dest_path): - coll_name = src_path.rsplit('/',1)[1] + coll_name = src_path.rsplit('/', 1)[1] target_path = dest_path + '/' + coll_name else: target_path = dest_path @@ -86,15 +87,12 @@ def move(self, src_path, dest_path): KeyValPair_PI=StringStringMap(), ) message_body = ObjCopyRequest( - srcDataObjInp_PI = src, - destDataObjInp_PI = dest + srcDataObjInp_PI=src, + destDataObjInp_PI=dest ) message = iRODSMessage('RODS_API_REQ', msg=message_body, - int_info=api_number['DATA_OBJ_RENAME_AN']) + int_info=api_number['DATA_OBJ_RENAME_AN']) with self.sess.pool.get_connection() as conn: conn.send(message) response = conn.recv() - - - diff --git a/irods/manager/data_object_manager.py b/irods/manager/data_object_manager.py index 1710c86ee7..906088cd41 100644 --- a/irods/manager/data_object_manager.py +++ b/irods/manager/data_object_manager.py @@ -2,7 +2,8 @@ from irods.models import DataObject from irods.manager import Manager -from irods.message import (iRODSMessage, FileOpenRequest, ObjCopyRequest, StringStringMap) +from irods.message import ( + iRODSMessage, FileOpenRequest, ObjCopyRequest, StringStringMap) from irods.exception import (DataObjectDoesNotExist, CollectionDoesNotExist) from irods.api_number import api_number from irods.data_object import iRODSDataObject @@ -12,7 +13,9 @@ SEEK_CUR = 1 SEEK_END = 2 + class DataObjectManager(Manager): + def get(self, path): try: parent = self.sess.collections.get(dirname(path)) @@ -43,7 +46,7 @@ def create(self, path, resource=None, options={}): KeyValPair_PI=StringStringMap(kvp), ) message = iRODSMessage('RODS_API_REQ', msg=message_body, - int_info=api_number['DATA_OBJ_CREATE_AN']) + int_info=api_number['DATA_OBJ_CREATE_AN']) with self.sess.pool.get_connection() as conn: conn.send(message) @@ -64,8 +67,8 @@ def open(self, path, mode): oprType=0, KeyValPair_PI=StringStringMap(), ) - message = iRODSMessage('RODS_API_REQ', msg=message_body, - int_info=api_number['DATA_OBJ_OPEN_AN']) + message = iRODSMessage('RODS_API_REQ', msg=message_body, + int_info=api_number['DATA_OBJ_OPEN_AN']) conn = self.sess.pool.get_connection() conn.send(message) @@ -87,7 +90,7 @@ def unlink(self, path, force=False): KeyValPair_PI=StringStringMap(options), ) message = iRODSMessage('RODS_API_REQ', msg=message_body, - int_info=api_number['DATA_OBJ_UNLINK_AN']) + int_info=api_number['DATA_OBJ_UNLINK_AN']) with self.sess.pool.get_connection() as conn: conn.send(message) @@ -97,11 +100,11 @@ def move(self, src_path, dest_path): # check if dest is a collection # if so append filename to it if self.sess.collections.exists(dest_path): - filename = src_path.rsplit('/',1)[1] + filename = src_path.rsplit('/', 1)[1] target_path = dest_path + '/' + filename else: target_path = dest_path - + src = FileOpenRequest( objPath=src_path, createMode=0, @@ -123,11 +126,11 @@ def move(self, src_path, dest_path): KeyValPair_PI=StringStringMap(), ) message_body = ObjCopyRequest( - srcDataObjInp_PI = src, - destDataObjInp_PI = dest + srcDataObjInp_PI=src, + destDataObjInp_PI=dest ) message = iRODSMessage('RODS_API_REQ', msg=message_body, - int_info=api_number['DATA_OBJ_RENAME_AN']) + int_info=api_number['DATA_OBJ_RENAME_AN']) with self.sess.pool.get_connection() as conn: conn.send(message) @@ -169,4 +172,3 @@ def replicate(self, path, options={}): with self.sess.pool.get_connection() as conn: conn.send(message) response = conn.recv() - diff --git a/irods/manager/metadata_manager.py b/irods/manager/metadata_manager.py index f8d0085f8e..38495612e0 100644 --- a/irods/manager/metadata_manager.py +++ b/irods/manager/metadata_manager.py @@ -4,13 +4,16 @@ from irods.manager import Manager from irods.message import MetadataRequest, iRODSMessage from irods.api_number import api_number -from irods.models import (DataObject, Collection, Resource, User, DataObjectMeta, - CollectionMeta, ResourceMeta, UserMeta) +from irods.models import ( + DataObject, Collection, Resource, User, DataObjectMeta, + CollectionMeta, ResourceMeta, UserMeta) from irods.meta import iRODSMeta logger = logging.getLogger(__name__) + class MetadataManager(Manager): + @staticmethod def _model_class_to_resource_type(model_cls): return { @@ -57,7 +60,7 @@ def add(self, model_cls, path, meta): meta.units ) request = iRODSMessage("RODS_API_REQ", msg=message_body, - int_info=api_number['MOD_AVU_METADATA_AN']) + int_info=api_number['MOD_AVU_METADATA_AN']) with self.sess.pool.get_connection() as conn: conn.send(request) response = conn.recv() @@ -74,7 +77,7 @@ def remove(self, model_cls, path, meta): meta.units ) request = iRODSMessage("RODS_API_REQ", msg=message_body, - int_info=api_number['MOD_AVU_METADATA_AN']) + int_info=api_number['MOD_AVU_METADATA_AN']) with self.sess.pool.get_connection() as conn: conn.send(request) response = conn.recv() @@ -91,7 +94,7 @@ def copy(self, src_model_cls, dest_model_cls, src, dest): dest ) request = iRODSMessage("RODS_API_REQ", msg=message_body, - int_info=api_number['MOD_AVU_METADATA_AN']) + int_info=api_number['MOD_AVU_METADATA_AN']) with self.sess.pool.get_connection() as conn: conn.send(request) @@ -109,7 +112,7 @@ def set(self, model_cls, path, meta): meta.units ) request = iRODSMessage("RODS_API_REQ", msg=message_body, - int_info=api_number['MOD_AVU_METADATA_AN']) + int_info=api_number['MOD_AVU_METADATA_AN']) with self.sess.pool.get_connection() as conn: conn.send(request) response = conn.recv() diff --git a/irods/manager/resource_manager.py b/irods/manager/resource_manager.py index 07235a91b0..8897a589ab 100644 --- a/irods/manager/resource_manager.py +++ b/irods/manager/resource_manager.py @@ -9,19 +9,20 @@ logger = logging.getLogger(__name__) + class ResourceManager(Manager): + def get(self, name, zone=""): query = self.sess.query(Resource).filter(Resource.name == name) - + if len(zone) > 0: query = query.filter(Resource.zone_name == zone) - + try: result = query.one() except NoResultFound: raise ResourceDoesNotExist() return iRODSResource(self, result) - def create(self, name, resource_type, host, path, context="", zone="", resource_class=""): with self.sess.pool.get_connection() as conn: @@ -56,10 +57,11 @@ def create(self, name, resource_type, host, path, context="", zone="", resource_ conn.send(request) response = conn.recv() - self.sess.cleanup() # close connections to get new agents with up to date resource manager + self.sess.cleanup() + # close connections to get new agents with up to + # date resource manager logger.debug(response.int_info) - def remove(self, name, test=False): if test: mode = "--dryrun" @@ -76,5 +78,7 @@ def remove(self, name, test=False): with self.sess.pool.get_connection() as conn: conn.send(request) response = conn.recv() - self.sess.cleanup() # close connections to get new agents with up to date resource manager + self.sess.cleanup() + # close connections to get new agents with up to + # date resource manager logger.debug(response.int_info) diff --git a/irods/manager/user_manager.py b/irods/manager/user_manager.py index a8f165d0c6..a98b21c86d 100644 --- a/irods/manager/user_manager.py +++ b/irods/manager/user_manager.py @@ -9,20 +9,21 @@ logger = logging.getLogger(__name__) + class UserManager(Manager): + def get(self, user_name, user_zone=""): query = self.sess.query(User).filter(User.name == user_name) - + if len(user_zone) > 0: query = query.filter(User.zone == user_zone) - + try: result = query.one() except NoResultFound: raise UserDoesNotExist() return iRODSUser(self, result) - - + def create(self, user_name, user_type, user_zone="", auth_str=""): message_body = GeneralAdminRequest( "add", @@ -39,7 +40,7 @@ def create(self, user_name, user_type, user_zone="", auth_str=""): response = conn.recv() logger.debug(response.int_info) return self.get(user_name, user_zone) - + def remove(self, user_name, user_zone=""): message_body = GeneralAdminRequest( "rm", @@ -53,8 +54,7 @@ def remove(self, user_name, user_zone=""): conn.send(request) response = conn.recv() logger.debug(response.int_info) - - + def modify(self, user_name, option, new_value, user_zone=""): # checks if option == 'password': @@ -63,7 +63,7 @@ def modify(self, user_name, option, new_value, user_zone=""): # must append zone to username for this API call if len(user_zone) > 0: user_name += "#" + user_zone - + message_body = GeneralAdminRequest( "modify", "user", @@ -81,6 +81,7 @@ def modify(self, user_name, option, new_value, user_zone=""): class UserGroupManager(UserManager): + def get(self, name): query = self.sess.query(UserGroup).filter(UserGroup.name == name) @@ -108,7 +109,8 @@ def create(self, name): return self.get(name) def getmembers(self, name): - results = self.sess.query(User).filter(User.type != 'rodsgroup', UserGroup.name == name).get_results() + results = self.sess.query(User).filter( + User.type != 'rodsgroup', UserGroup.name == name).get_results() return [iRODSUser(self, row) for row in results] def addmember(self, group_name, user_name, user_zone=""): @@ -126,7 +128,7 @@ def addmember(self, group_name, user_name, user_zone=""): conn.send(request) response = conn.recv() logger.debug(response.int_info) - + def removemember(self, group_name, user_name, user_zone=""): message_body = GeneralAdminRequest( "modify", diff --git a/irods/message/__init__.py b/irods/message/__init__.py index 244a14c8a1..ed43a3ec38 100644 --- a/irods/message/__init__.py +++ b/irods/message/__init__.py @@ -5,12 +5,13 @@ from irods import IRODS_VERSION from irods.message.message import Message -from irods.message.property import (BinaryProperty, StringProperty, - IntegerProperty, LongProperty, ArrayProperty, - SubmessageProperty) +from irods.message.property import (BinaryProperty, StringProperty, + IntegerProperty, LongProperty, ArrayProperty, + SubmessageProperty) logger = logging.getLogger(__name__) + def _recv_message_in_len(sock, size): size_left = size retbuf = None @@ -24,7 +25,9 @@ def _recv_message_in_len(sock, size): return retbuf + class iRODSMessage(object): + def __init__(self, type=None, msg=None, error=None, bs=None, int_info=None): self.type = type self.msg = msg @@ -34,12 +37,12 @@ def __init__(self, type=None, msg=None, error=None, bs=None, int_info=None): @staticmethod def recv(sock): - #rsp_header_size = sock.recv(4, socket.MSG_WAITALL) + # rsp_header_size = sock.recv(4, socket.MSG_WAITALL) rsp_header_size = _recv_message_in_len(sock, 4) rsp_header_size = struct.unpack(">i", rsp_header_size)[0] - #rsp_header = sock.recv(rsp_header_size, socket.MSG_WAITALL) + # rsp_header = sock.recv(rsp_header_size, socket.MSG_WAITALL) rsp_header = _recv_message_in_len(sock, rsp_header_size) - + xml_root = ET.fromstring(rsp_header) type = xml_root.find('type').text msg_len = int(xml_root.find('msgLen').text) @@ -47,15 +50,17 @@ def recv(sock): bs_len = int(xml_root.find('bsLen').text) int_info = int(xml_root.find('intInfo').text) - #message = sock.recv(msg_len, socket.MSG_WAITALL) if msg_len != 0 else None + # message = sock.recv(msg_len, socket.MSG_WAITALL) if msg_len != 0 else + # None message = _recv_message_in_len(sock, msg_len) if msg_len != 0 else None - #error = sock.recv(err_len, socket.MSG_WAITALL) if err_len != 0 else None + # error = sock.recv(err_len, socket.MSG_WAITALL) if err_len != 0 else + # None error = _recv_message_in_len(sock, err_len) if err_len != 0 else None - #bs = sock.recv(bs_len, socket.MSG_WAITALL) if bs_len != 0 else None + # bs = sock.recv(bs_len, socket.MSG_WAITALL) if bs_len != 0 else None bs = _recv_message_in_len(sock, bs_len) if bs_len != 0 else None - - #if message: - #logger.debug(message) + + # if message: + # logger.debug(message) return iRODSMessage(type, message, error, bs, int_info) @@ -64,12 +69,12 @@ def pack(self): msg_header = "%s%d\ %d%d%d\ " % ( - self.type, - len(main_msg) if main_msg else 0, - len(self.error) if self.error else 0, - len(self.bs) if self.bs else 0, + self.type, + len(main_msg) if main_msg else 0, + len(self.error) if self.error else 0, + len(self.bs) if self.bs else 0, self.int_info if self.int_info else 0 - ) + ) msg_header_length = struct.pack(">i", len(msg_header)) parts = [x for x in [main_msg, self.error, self.bs] if x is not None] msg = msg_header_length + msg_header + "".join(parts) @@ -81,17 +86,24 @@ def get_main_message(self, cls): msg.unpack(ET.fromstring(self.msg)) return msg -#define StartupPack_PI "int irodsProt; int reconnFlag; int connectCnt; str proxyUser[NAME_LEN]; str proxyRcatZone[NAME_LEN]; str clientUser[NAME_LEN]; str clientRcatZone[NAME_LEN]; str relVersion[NAME_LEN]; str apiVersion[NAME_LEN]; str option[NAME_LEN];" +# define StartupPack_PI "int irodsProt; int reconnFlag; int connectCnt; +# str proxyUser[NAME_LEN]; str proxyRcatZone[NAME_LEN]; str +# clientUser[NAME_LEN]; str clientRcatZone[NAME_LEN]; str +# relVersion[NAME_LEN]; str apiVersion[NAME_LEN]; str option[NAME_LEN];" + + class StartupPack(Message): _name = 'StartupPack_PI' + def __init__(self, proxy_user, client_user): super(StartupPack, self).__init__() if proxy_user and client_user: - self.irodsProt = 1 + self.irodsProt = 1 self.connectCnt = 0 self.proxyUser, self.proxyRcatZone = proxy_user self.clientUser, self.clientRcatZone = client_user - self.relVersion = "rods{major}.{minor}.{patchlevel}".format(**IRODS_VERSION) + self.relVersion = "rods{major}.{minor}.{patchlevel}".format( + **IRODS_VERSION) self.apiVersion = "{api}".format(**IRODS_VERSION) self.option = "" @@ -106,19 +118,25 @@ def __init__(self, proxy_user, client_user): apiVersion = StringProperty() option = StringProperty() -#define authResponseInp_PI "bin *response(RESPONSE_LEN); str *username;" +# define authResponseInp_PI "bin *response(RESPONSE_LEN); str *username;" + + class AuthResponse(Message): _name = 'authResponseInp_PI' response = BinaryProperty(16) username = StringProperty() + class AuthChallenge(Message): _name = 'authRequestOut_PI' challenge = BinaryProperty(64) -#define InxIvalPair_PI "int iiLen; int *inx(iiLen); int *ivalue(iiLen);" +# define InxIvalPair_PI "int iiLen; int *inx(iiLen); int *ivalue(iiLen);" + + class IntegerIntegerMap(Message): _name = 'InxIvalPair_PI' + def __init__(self, data=None): super(IntegerIntegerMap, self).__init__() self.iiLen = 0 @@ -131,9 +149,12 @@ def __init__(self, data=None): inx = ArrayProperty(IntegerProperty()) ivalue = ArrayProperty(IntegerProperty()) -#define InxValPair_PI "int isLen; int *inx(isLen); str *svalue[isLen];" +# define InxValPair_PI "int isLen; int *inx(isLen); str *svalue[isLen];" + + class IntegerStringMap(Message): _name = 'InxValPair_PI' + def __init__(self, data=None): super(IntegerStringMap, self).__init__() self.isLen = 0 @@ -146,9 +167,12 @@ def __init__(self, data=None): inx = ArrayProperty(IntegerProperty()) svalue = ArrayProperty(StringProperty()) -#define KeyValPair_PI "int ssLen; str *keyWord[ssLen]; str *svalue[ssLen];" +# define KeyValPair_PI "int ssLen; str *keyWord[ssLen]; str *svalue[ssLen];" + + class StringStringMap(Message): _name = 'KeyValPair_PI' + def __init__(self, data=None): super(StringStringMap, self).__init__() self.ssLen = 0 @@ -159,9 +183,13 @@ def __init__(self, data=None): ssLen = IntegerProperty() keyWord = ArrayProperty(StringProperty()) - svalue = ArrayProperty(StringProperty()) + svalue = ArrayProperty(StringProperty()) + +# define GenQueryInp_PI "int maxRows; int continueInx; int +# partialStartIndex; int options; struct KeyValPair_PI; struct +# InxIvalPair_PI; struct InxValPair_PI;" + -#define GenQueryInp_PI "int maxRows; int continueInx; int partialStartIndex; int options; struct KeyValPair_PI; struct InxIvalPair_PI; struct InxValPair_PI;" class GenQueryRequest(Message): _name = 'GenQueryInp_PI' maxRows = IntegerProperty() @@ -172,14 +200,19 @@ class GenQueryRequest(Message): InxIvalPair_PI = SubmessageProperty(IntegerIntegerMap) InxValPair_PI = SubmessageProperty(IntegerStringMap) -#define SqlResult_PI "int attriInx; int reslen; str *value(rowCnt)(reslen);" +# define SqlResult_PI "int attriInx; int reslen; str *value(rowCnt)(reslen);" + + class GenQueryResponseColumn(Message): _name = 'SqlResult_PI' attriInx = IntegerProperty() reslen = IntegerProperty() value = ArrayProperty(StringProperty()) -#define GenQueryOut_PI "int rowCnt; int attriCnt; int continueInx; int totalRowCount; struct SqlResult_PI[MAX_SQL_ATTR];" +# define GenQueryOut_PI "int rowCnt; int attriCnt; int continueInx; int +# totalRowCount; struct SqlResult_PI[MAX_SQL_ATTR];" + + class GenQueryResponse(Message): _name = 'GenQueryOut_PI' rowCnt = IntegerProperty() @@ -188,7 +221,11 @@ class GenQueryResponse(Message): totalRowCount = IntegerProperty() SqlResult_PI = ArrayProperty(SubmessageProperty(GenQueryResponseColumn)) -#define DataObjInp_PI "str objPath[MAX_NAME_LEN]; int createMode; int openFlags; double offset; double dataSize; int numThreads; int oprType; struct *SpecColl_PI; struct KeyValPair_PI;" +# define DataObjInp_PI "str objPath[MAX_NAME_LEN]; int createMode; int +# openFlags; double offset; double dataSize; int numThreads; int oprType; +# struct *SpecColl_PI; struct KeyValPair_PI;" + + class FileOpenRequest(Message): _name = 'DataObjInp_PI' objPath = StringProperty() @@ -200,7 +237,10 @@ class FileOpenRequest(Message): oprType = IntegerProperty() KeyValPair_PI = SubmessageProperty(StringStringMap) -#define OpenedDataObjInp_PI "int l1descInx; int len; int whence; int oprType; double offset; double bytesWritten; struct KeyValPair_PI;" +# define OpenedDataObjInp_PI "int l1descInx; int len; int whence; int +# oprType; double offset; double bytesWritten; struct KeyValPair_PI;" + + class OpenedDataObjRequest(Message): _name = 'OpenedDataObjInp_PI' l1descInx = IntegerProperty() @@ -211,20 +251,28 @@ class OpenedDataObjRequest(Message): bytesWritten = LongProperty() KeyValPair_PI = SubmessageProperty(StringStringMap) -#define fileLseekOut_PI "double offset;" +# define fileLseekOut_PI "double offset;" + + class FileSeekResponse(Message): _name = 'fileLseekOut_PI' offset = LongProperty() -#define DataObjCopyInp_PI "struct DataObjInp_PI; struct DataObjInp_PI;" +# define DataObjCopyInp_PI "struct DataObjInp_PI; struct DataObjInp_PI;" + + class ObjCopyRequest(Message): _name = 'DataObjCopyInp_PI' srcDataObjInp_PI = SubmessageProperty(FileOpenRequest) destDataObjInp_PI = SubmessageProperty(FileOpenRequest) -#define ModAVUMetadataInp_PI "str *arg0; str *arg1; str *arg2; str *arg3; str *arg4; str *arg5; str *arg6; str *arg7; str *arg8; str *arg9;" +# define ModAVUMetadataInp_PI "str *arg0; str *arg1; str *arg2; str *arg3; +# str *arg4; str *arg5; str *arg6; str *arg7; str *arg8; str *arg9;" + + class MetadataRequest(Message): _name = 'ModAVUMetadataInp_PI' + def __init__(self, *args): super(MetadataRequest, self).__init__() for i in range(len(args)): @@ -242,7 +290,10 @@ def __init__(self, *args): arg8 = StringProperty() arg9 = StringProperty() -#define modAccessControlInp_PI "int recursiveFlag; str *accessLevel; str *userName; str *zone; str *path;" +# define modAccessControlInp_PI "int recursiveFlag; str *accessLevel; str +# *userName; str *zone; str *path;" + + class ModAclRequest(Message): _name = 'modAccessControlInp_PI' recursiveFlag = IntegerProperty() @@ -251,7 +302,9 @@ class ModAclRequest(Message): zone = StringProperty() path = StringProperty() -#define CollInp_PI "str collName[MAX_NAME_LEN]; struct KeyValPair_PI;" +# define CollInp_PI "str collName[MAX_NAME_LEN]; struct KeyValPair_PI;" + + class CollectionRequest(Message): _name = 'CollInpNew_PI' collName = StringProperty() @@ -259,7 +312,11 @@ class CollectionRequest(Message): oprType = IntegerProperty() KeyValPair_PI = SubmessageProperty(StringStringMap) -#define Version_PI "int status; str relVersion[NAME_LEN]; str apiVersion[NAME_LEN]; int reconnPort; str reconnAddr[LONG_NAME_LEN]; int cookie;" +# define Version_PI "int status; str relVersion[NAME_LEN]; str +# apiVersion[NAME_LEN]; int reconnPort; str reconnAddr[LONG_NAME_LEN]; int +# cookie;" + + class VersionResponse(Message): _name = 'Version_PI' status = IntegerProperty() @@ -269,9 +326,13 @@ class VersionResponse(Message): reconnAddr = StringProperty() cookie = IntegerProperty() -#define generalAdminInp_PI "str *arg0; str *arg1; str *arg2; str *arg3; str *arg4; str *arg5; str *arg6; str *arg7; str *arg8; str *arg9;" +# define generalAdminInp_PI "str *arg0; str *arg1; str *arg2; str *arg3; +# str *arg4; str *arg5; str *arg6; str *arg7; str *arg8; str *arg9;" + + class GeneralAdminRequest(Message): _name = 'generalAdminInp_PI' + def __init__(self, *args): super(GeneralAdminRequest, self).__init__() for i in range(10): @@ -291,11 +352,13 @@ def __init__(self, *args): arg8 = StringProperty() arg9 = StringProperty() + def empty_gen_query_out(cols): - sql_results = [GenQueryResponseColumn(attriInx=col.icat_id, value=[]) for col in cols] + sql_results = [GenQueryResponseColumn(attriInx=col.icat_id, value=[]) + for col in cols] gqo = GenQueryResponse( rowCnt=0, attriCnt=len(cols), SqlResult_PI=sql_results - ) + ) return gqo diff --git a/irods/message/message.py b/irods/message/message.py index dd1454ca49..520db15232 100644 --- a/irods/message/message.py +++ b/irods/message/message.py @@ -4,12 +4,15 @@ from irods.message.ordered import OrderedProperty, OrderedMetaclass, OrderedClass + class MessageMetaclass(OrderedMetaclass): + def __init__(self, name, bases, attys): super(MessageMetaclass, self).__init__(name, bases, attys) for name, property in self._ordered_properties: property.dub(name) + class Message(OrderedClass): __metaclass__ = MessageMetaclass diff --git a/irods/message/ordered.py b/irods/message/ordered.py index 058be7cd5e..696955a9b3 100644 --- a/irods/message/ordered.py +++ b/irods/message/ordered.py @@ -3,12 +3,16 @@ from itertools import count next_counter = count().next + class OrderedProperty(object): + def __init__(self, *args, **kws): self._creation_counter = next_counter() super(OrderedProperty, self).__init__(*args, **kws) + class OrderedMetaclass(type): + def __init__(self, name, bases, attys): super(OrderedMetaclass, self).__init__(name, bases, attys) self._creation_counter = next_counter() @@ -20,8 +24,9 @@ def __init__(self, name, bases, attys): if isinstance(value, OrderedProperty) or isinstance(value, OrderedMetaclass) ), - key = lambda (name, property): property._creation_counter, + key=lambda (name, property): property._creation_counter, ) + class OrderedClass(object): __metaclass__ = OrderedMetaclass diff --git a/irods/message/property.py b/irods/message/property.py index ebff7d3906..d551994a6d 100644 --- a/irods/message/property.py +++ b/irods/message/property.py @@ -2,7 +2,9 @@ from irods.message.ordered import OrderedProperty, OrderedMetaclass, OrderedClass + class MessageProperty(OrderedProperty): + def __get__(self, obj, cls): return obj._values[self.name] @@ -26,21 +28,27 @@ def unpack(self, els): return self.parse(el.text) return None + class IntegerProperty(MessageProperty): + def format(self, value): return str(value) def parse(self, value): return int(value) + class LongProperty(MessageProperty): + def format(self, value): return str(value) def parse(self, value): return int(value) + class BinaryProperty(MessageProperty): + def __init__(self, length): self.length = length super(BinaryProperty, self).__init__() @@ -51,7 +59,9 @@ def format(self, value): def parse(self, value): return b64decode(value) + class StringProperty(MessageProperty): + def __init__(self, length=None): self.length = length super(StringProperty, self).__init__() @@ -66,7 +76,9 @@ def parse(self, value): return value.decode('utf-8') return value + class ArrayProperty(MessageProperty): + def __init__(self, property): self.property = property super(ArrayProperty, self).__init__() @@ -78,7 +90,9 @@ def pack(self, values): def unpack(self, els): return [self.property.unpack([el]) for el in els] + class SubmessageProperty(MessageProperty): + def __init__(self, message_cls): self.message_cls = message_cls super(SubmessageProperty, self).__init__() diff --git a/irods/models.py b/irods/models.py index c0f2607f53..a29b6e3a5f 100644 --- a/irods/models.py +++ b/irods/models.py @@ -1,22 +1,27 @@ from irods.column import Column, Integer, String, DateTime, Keyword + class ModelBase(type): columns = {} + def __new__(cls, name, bases, attr): - columns = [y for (x,y) in attr.iteritems() if isinstance(y, Column)] + columns = [y for (x, y) in attr.iteritems() if isinstance(y, Column)] for col in columns: ModelBase.columns[col.icat_id] = col attr['_columns'] = columns - #attr['_icat_column_names'] = [y.icat_key for (x,y) in columns] + # attr['_icat_column_names'] = [y.icat_key for (x,y) in columns] return type.__new__(cls, name, bases, attr) + class Model(object): __metaclass__ = ModelBase + class Zone(Model): id = Column(Integer, 'ZONE_ID', 101) name = Column(String, 'ZONE_NAME', 102) + class User(Model): id = Column(Integer, 'USER_ID', 201) name = Column(String, 'USER_NAME', 202) @@ -29,14 +34,18 @@ class User(Model): modify_time = Column(DateTime, 'USER_MODIFY_TIME', 209) # R_COLL_USER_MAIN in rodsGenQuery.h + + class CollectionUser(Model): name = Column(String, 'COL_COLL_USER_NAME', 1300) zone = Column(String, 'COL_COLL_USER_ZONE', 1301) + class UserGroup(Model): id = Column(Integer, 'USER_GROUP_ID', 900) name = Column(String, 'USER_GROUP_NAME', 901) + class Resource(Model): id = Column(Integer, 'R_RESC_ID', 301) name = Column(String, 'R_RESC_NAME', 302) @@ -56,16 +65,17 @@ class Resource(Model): parent = Column(String, 'R_RESC_PARENT', 317) obj_count = Column(Integer, 'R_RESC_OBJCOUNT', 318) + class DataObject(Model): - id = Column(Integer, 'D_DATA_ID', 401) + id = Column(Integer, 'D_DATA_ID', 401) collection_id = Column(Integer, 'D_COLL_ID', 402) - name = Column(String, 'DATA_NAME', 403) # basename + name = Column(String, 'DATA_NAME', 403) # basename replica_number = Column(Integer, 'DATA_REPL_NUM', 404) version = Column(String, 'DATA_VERSION', 405) type = Column(String, 'DATA_TYPE_NAME', 406) size = Column(Integer, 'DATA_SIZE', 407) resource_name = Column(String, 'D_RESC_NAME', 409) - path = Column(String, 'D_DATA_PATH', 410) # physical path on resource + path = Column(String, 'D_DATA_PATH', 410) # physical path on resource owner_name = Column(String, 'D_OWNER_NAME', 411) owner_zone = Column(String, 'D_OWNER_ZONE', 412) replica_status = Column(String, 'D_REPL_STATUS', 413) @@ -77,7 +87,8 @@ class DataObject(Model): create_time = Column(DateTime, 'D_CREATE_TIME', 419) modify_time = Column(DateTime, 'D_MODIFY_TIME', 420) resc_hier = Column(String, 'D_RESC_HIER', 422) - + + class Collection(Model): id = Column(Integer, 'COLL_ID', 500) name = Column(String, 'COLL_NAME', 501) @@ -90,30 +101,35 @@ class Collection(Model): create_time = Column(DateTime, 'COLL_CREATE_TIME', 508) modify_time = Column(DateTime, 'COLL_MODIFY_TIME', 509) + class DataObjectMeta(Model): id = Column(String, 'COL_META_DATA_ATTR_ID', 603) name = Column(String, 'COL_META_DATA_ATTR_NAME', 600) value = Column(String, 'COL_META_DATA_ATTR_VALUE', 601) units = Column(String, 'COL_META_DATA_ATTR_UNITS', 602) + class CollectionMeta(Model): id = Column(String, 'COL_META_COLL_ATTR_UNITS', 613) name = Column(String, 'COL_META_COLL_ATTR_NAME', 610) value = Column(String, 'COL_META_COLL_ATTR_VALUE', 611) units = Column(String, 'COL_META_COLL_ATTR_UNITS', 612) + class ResourceMeta(Model): id = Column(String, 'COL_META_RESC_ATTR_UNITS', 633) name = Column(String, 'COL_META_RESC_ATTR_NAME', 630) value = Column(String, 'COL_META_RESC_ATTR_VALUE', 631) units = Column(String, 'COL_META_RESC_ATTR_UNITS', 632) + class UserMeta(Model): id = Column(String, 'COL_META_USER_ATTR_ID', 643) name = Column(String, 'COL_META_USER_ATTR_NAME', 640) value = Column(String, 'COL_META_USER_ATTR_VALUE', 641) units = Column(String, 'COL_META_USER_ATTR_UNITS', 642) + class DataAccess(Model): type = Column(Integer, 'DATA_ACCESS_TYPE', 700) name = Column(String, 'COL_DATA_ACCESS_NAME', 701) @@ -121,6 +137,7 @@ class DataAccess(Model): user_id = Column(Integer, 'COL_DATA_ACCESS_USER_ID', 703) data_id = Column(Integer, 'COL_DATA_ACCESS_DATA_ID', 704) + class CollectionAccess(Model): type = Column(Integer, 'COL_COLL_ACCESS_TYPE', 710) name = Column(String, 'COL_COLL_ACCESS_NAME', 711) diff --git a/irods/pool.py b/irods/pool.py index 8e3cbcb053..353ba17d69 100644 --- a/irods/pool.py +++ b/irods/pool.py @@ -5,13 +5,15 @@ logger = logging.getLogger(__name__) + class Pool(object): + def __init__(self, account): self.account = account self._lock = threading.Lock() self.active = set() self.idle = set() - + def get_connection(self): with self._lock: try: diff --git a/irods/resource.py b/irods/resource.py index cd5d967f69..907e431854 100644 --- a/irods/resource.py +++ b/irods/resource.py @@ -1,7 +1,9 @@ import sys from irods.models import Resource + class iRODSResource(object): + def __init__(self, manager, result=None): self.manager = manager if result: diff --git a/irods/results.py b/irods/results.py index 496a4c0bb5..a635492c1e 100644 --- a/irods/results.py +++ b/irods/results.py @@ -2,7 +2,9 @@ from irods.models import ModelBase + class ResultSet(object): + def __init__(self, raw): self.length = raw.rowCnt col_length = raw.attriCnt @@ -16,7 +18,8 @@ def __init__(self, raw): def __str__(self): table = PrettyTable() for col in self.cols: - table.add_column(ModelBase.columns[col.attriInx].icat_key, col.value) + table.add_column( + ModelBase.columns[col.attriInx].icat_key, col.value) table.align = 'l' return table.get_string().encode('utf-8') @@ -29,7 +32,7 @@ def format(attribute_index, value): return (col, col.type.to_python(value)) except (TypeError, ValueError): return (col, value) - + return dict([format(col.attriInx, value) for col, value in values]) def __getitem__(self, index): @@ -40,14 +43,13 @@ def __iter__(self): def __len__(self): return self.length - + # For testing. Might go somewhere else... def has_value(self, value): found = False - + for row in self.rows: if value in row.values(): found = True - + return found - diff --git a/irods/session.py b/irods/session.py index 35a695194d..47c3c49817 100644 --- a/irods/session.py +++ b/irods/session.py @@ -9,7 +9,9 @@ from irods.manager.resource_manager import ResourceManager from irods.exception import NetworkException + class iRODSSession(object): + def __init__(self, *args, **kwargs): self.pool = None if args or kwargs: @@ -21,13 +23,13 @@ def __init__(self, *args, **kwargs): self.users = UserManager(self) self.user_groups = UserGroupManager(self) self.resources = ResourceManager(self) - + def __enter__(self): return self - + def __exit__(self, exc_type, exc_value, traceback): self.cleanup() - + def cleanup(self): for conn in self.pool.active | self.pool.idle: try: @@ -36,9 +38,10 @@ def cleanup(self): pass conn.release(True) - def configure(self, host=None, port=1247, user=None, zone=None, - password=None, client_user=None, client_zone=None): - account = iRODSAccount(host, int(port), user, zone, password, client_user, + def configure(self, host=None, port=1247, user=None, zone=None, + password=None, client_user=None, client_zone=None): + account = iRODSAccount( + host, int(port), user, zone, password, client_user, client_zone) self.pool = Pool(account) diff --git a/irods/test/admin_test.py b/irods/test/admin_test.py index deba882b2e..3859f8c6f2 100644 --- a/irods/test/admin_test.py +++ b/irods/test/admin_test.py @@ -34,12 +34,12 @@ def tearDown(self): def test_session_with_client_user(self): # stub with iRODSSession(host=config.IRODS_SERVER_HOST, - port=config.IRODS_SERVER_PORT, - user=config.IRODS_USER_USERNAME, - password=config.IRODS_USER_PASSWORD, - zone=config.IRODS_SERVER_ZONE, - client_user=config.IRODS_USER_USERNAME, - client_zone=config.IRODS_SERVER_ZONE) as sess: + port=config.IRODS_SERVER_PORT, + user=config.IRODS_USER_USERNAME, + password=config.IRODS_USER_PASSWORD, + zone=config.IRODS_SERVER_ZONE, + client_user=config.IRODS_USER_USERNAME, + client_zone=config.IRODS_SERVER_ZONE) as sess: self.assertTrue(sess) def test_create_delete_local_user(self): @@ -117,7 +117,8 @@ def test_modify_user_type_with_zone(self): self.assertEqual(row[User.type], self.new_user_type) # change type to rodsadmin - self.sess.users.modify(self.new_user_name+'#'+self.new_user_zone, 'type', 'rodsadmin') + self.sess.users.modify( + self.new_user_name + '#' + self.new_user_zone, 'type', 'rodsadmin') # check type again row = self.sess.query(User.type).filter( @@ -134,7 +135,7 @@ def test_modify_user_type_with_zone(self): def test_make_new_ufs_resource(self): # test data resc_name = 'temporary_test_resource' - if config.IRODS_SERVER_VERSION < (4, 0, 0): + if config.IRODS_SERVER_VERSION < (4, 0, 0): resc_type = 'unix file system' resc_class = 'cache' else: @@ -151,7 +152,8 @@ def test_make_new_ufs_resource(self): obj_path = '{coll_path}/{obj_name}'.format(**locals()) # make new resource - self.sess.resources.create(resc_name, resc_type, resc_host, resc_path, resource_class = resc_class) + self.sess.resources.create( + resc_name, resc_type, resc_host, resc_path, resource_class=resc_class) # try invalid params with self.assertRaises(ResourceDoesNotExist): diff --git a/irods/test/collection_test.py b/irods/test/collection_test.py index fd7ab55a26..8f6528e5ff 100644 --- a/irods/test/collection_test.py +++ b/irods/test/collection_test.py @@ -48,12 +48,13 @@ def test_update_in_collection(self): pass def test_remove_deep_collection(self): - #depth = 100 + # depth = 100 depth = 20 # placeholder root_coll_path = self.test_coll_path + "/deep_collection" # make test collection - helpers.make_deep_collection(self.sess, root_coll_path, depth=depth, objects_per_level=1, object_content=None) + helpers.make_deep_collection( + self.sess, root_coll_path, depth=depth, objects_per_level=1, object_content=None) # delete test collection self.sess.collections.remove(root_coll_path, recurse=True, force=True) @@ -140,7 +141,7 @@ def test_walk_collection_topdown(self): # now walk nested collections colls = self.test_coll.walk() current_coll_name = self.test_coll.name - for d in range(depth+1): + for d in range(depth + 1): # get next result collection, subcollections, data_objects = colls.next() @@ -161,7 +162,7 @@ def test_walk_collection_topdown(self): # iterate current_coll_name = sub_coll_name - + # that should be it with self.assertRaises(StopIteration): colls.next() @@ -181,29 +182,29 @@ def test_walk_collection(self): # now walk nested collections colls = self.test_coll.walk(topdown=False) - for d in range(depth-1, -2, -1): + for d in range(depth - 1, -2, -1): # get next result collection, subcollections, data_objects = colls.next() # check collection name if d >= 0: - coll_name = 'sub'+str(d) + coll_name = 'sub' + str(d) self.assertEqual(collection.name, coll_name) else: # root collection self.assertEqual(collection.name, self.test_coll.name) - + # check subcollection name - if d < depth-1: + if d < depth - 1: self.assertEqual(sub_coll_name, subcollections[0].name) else: # last coll has no subcolls self.assertListEqual(subcollections, []) - + # check data object names for data_object in data_objects: self.assertIn(data_object.name, filenames) - + # iterate sub_coll_name = coll_name diff --git a/irods/test/config.py b/irods/test/config.py index 6d9d609ed2..88c584b4af 100644 --- a/irods/test/config.py +++ b/irods/test/config.py @@ -3,4 +3,4 @@ IRODS_SERVER_ZONE = "tempZone" IRODS_USER_USERNAME = "rods" IRODS_USER_PASSWORD = "rods" -IRODS_SERVER_VERSION = (4, 2, 0) \ No newline at end of file +IRODS_SERVER_VERSION = (4, 2, 0) diff --git a/irods/test/connection_test.py b/irods/test/connection_test.py index 1979406f5c..ee49b7d8ce 100644 --- a/irods/test/connection_test.py +++ b/irods/test/connection_test.py @@ -56,8 +56,8 @@ def test_reply_failure(self): # try sending reply with self.assertRaises(NetworkException): conn.reply(0) - - + + if __name__ == '__main__': # let the tests find the parent irods lib sys.path.insert(0, os.path.abspath('../..')) diff --git a/irods/test/data_obj_test.py b/irods/test/data_obj_test.py index 5d0df27fa0..6fe12ab81b 100644 --- a/irods/test/data_obj_test.py +++ b/irods/test/data_obj_test.py @@ -30,7 +30,8 @@ def setUp(self): for token in conn.server_version.replace('rods', '').split('.')) # Create dummy test collection - self.coll_path = '/{0}/home/{1}/test_dir'.format(config.IRODS_SERVER_ZONE, config.IRODS_USER_USERNAME) + self.coll_path = '/{0}/home/{1}/test_dir'.format( + config.IRODS_SERVER_ZONE, config.IRODS_USER_USERNAME) self.coll = helpers.make_collection(self.sess, self.coll_path) def tearDown(self): @@ -101,7 +102,8 @@ def test_move_obj_to_coll(self): self.sess.data_objects.move(path, new_coll_path) # get new object id - new_path = "{collection}/{new_coll_name}/{file_name}".format(**locals()) + new_path = "{collection}/{new_coll_name}/{file_name}".format( + **locals()) obj = self.sess.data_objects.get(new_path) # compare ids @@ -179,8 +181,9 @@ def test_multiple_reads(self): with obj.open('r') as f: self.assertEqual(f.read(), obj.path) - - @unittest.skipIf(config.IRODS_SERVER_HOST != 'localhost' and config.IRODS_SERVER_HOST != socket.gethostname(), + @unittest.skipIf( + config.IRODS_SERVER_HOST != 'localhost' and config.IRODS_SERVER_HOST != socket.gethostname( + ), "Cannot modify remote server configuration") def test_create_with_checksum(self): # skip if server is older than 4.2 @@ -243,17 +246,18 @@ def test_create_with_checksum(self): def test_obj_replicate(self): # test data resc_name = 'temporary_test_resource' - if config.IRODS_SERVER_VERSION < (4, 0, 0): + if config.IRODS_SERVER_VERSION < (4, 0, 0): resc_type = 'unix file system' resc_class = 'cache' else: resc_type = 'unixfilesystem' resc_class = '' - resc_host = config.IRODS_SERVER_HOST # use remote host when available in CI + resc_host = config.IRODS_SERVER_HOST # use remote host when available in CI resc_path = '/tmp/' + resc_name # make second resource - self.sess.resources.create(resc_name, resc_type, resc_host, resc_path, resource_class = resc_class) + self.sess.resources.create( + resc_name, resc_type, resc_host, resc_path, resource_class=resc_class) # make test object on default resource collection = self.coll_path diff --git a/irods/test/extended_test.py b/irods/test/extended_test.py index bdf6bfb93c..7a43ef7d40 100644 --- a/irods/test/extended_test.py +++ b/irods/test/extended_test.py @@ -39,7 +39,8 @@ def test_walk_large_collection(self): # check object names counter = 0 for object in objects: - self.assertEqual(object.name, "dummy" + str(counter).zfill(6) + ".txt") + self.assertEqual( + object.name, "dummy" + str(counter).zfill(6) + ".txt") counter += 1 def test_files_generator(self): diff --git a/irods/test/helpers.py b/irods/test/helpers.py index cd243fbc2b..59840681ff 100644 --- a/irods/test/helpers.py +++ b/irods/test/helpers.py @@ -46,16 +46,20 @@ def make_deep_collection(session, root_path, depth=10, objects_per_level=50, obj # make collections recursively for d in range(depth): # make list of object names - obj_names = ['obj' + str(i).zfill(len(str(objects_per_level))) for i in range(objects_per_level)] + obj_names = ['obj' + str(i).zfill(len(str(objects_per_level))) + for i in range(objects_per_level)] # make subcollection and objects - if d == 0: - root_coll = make_collection(session, current_coll_path, obj_names, object_content) + if d == 0: + root_coll = make_collection( + session, current_coll_path, obj_names, object_content) else: - make_collection(session, current_coll_path, obj_names, object_content) + make_collection( + session, current_coll_path, obj_names, object_content) # next level down - current_coll_path = os.path.join(current_coll_path, 'subcoll'+ str(d).zfill(len(str(d)))) + current_coll_path = os.path.join( + current_coll_path, 'subcoll' + str(d).zfill(len(str(d)))) return root_coll @@ -67,4 +71,4 @@ def file_backed_up(filename): try: yield filename finally: - shutil.copyfile(f.name, filename) \ No newline at end of file + shutil.copyfile(f.name, filename) diff --git a/irods/test/meta_test.py b/irods/test/meta_test.py index 4cb92a7c2d..860f78fdf6 100644 --- a/irods/test/meta_test.py +++ b/irods/test/meta_test.py @@ -159,7 +159,7 @@ def test_meta_repr(self): # add metadata to test object meta = self.sess.metadata.add(DataObject, test_obj_path, - iRODSMeta(attribute, value, units)) + iRODSMeta(attribute, value, units)) # get metadata meta = self.sess.metadata.get(DataObject, test_obj_path) @@ -172,24 +172,24 @@ def test_meta_repr(self): # remove test object obj.unlink(force=True) - def test_irodsmetacollection_data_obj(self): ''' Tested as data_object metadata ''' # test settings avu_count = 5 - + # make test object test_obj_path = self.coll_path + '/test_irodsmetacollection' test_obj = helpers.make_object(self.sess, test_obj_path) # test AVUs - triplets = [('test_attr'+str(i), 'test_value', 'test_units') for i in range(avu_count)] + triplets = [('test_attr' + str(i), 'test_value', 'test_units') + for i in range(avu_count)] # get coll meta imc = test_obj.metadata - + # try invalid key with self.assertRaises(KeyError): imc.get_one('bad_key') @@ -205,12 +205,12 @@ def test_irodsmetacollection_data_obj(self): # add AVUs for triplet in triplets: imc.add(*triplet) - + # add another AVU with existing attribute name attr_name = triplets[0][0] duplicate_triplet = (attr_name, 'other_value', 'test_units') imc.add(*duplicate_triplet) - + # get_one should fail with self.assertRaises(KeyError): imc.get_one(attr_name) @@ -249,7 +249,7 @@ def test_irodsmetacollection_data_obj(self): # del item del imc[attr_name] - + with self.assertRaises(KeyError): imc[attr_name] diff --git a/irods/test/pool_test.py b/irods/test/pool_test.py index c4f0f4fbf3..5c9e0d8c2f 100644 --- a/irods/test/pool_test.py +++ b/irods/test/pool_test.py @@ -64,8 +64,6 @@ def test_release_disconnected(self): self.assertEqual(0, len(self.sess.pool.idle)) - - if __name__ == '__main__': # let the tests find the parent irods lib sys.path.insert(0, os.path.abspath('../..')) diff --git a/irods/test/query_test.py b/irods/test/query_test.py index 2197d26037..307ad70df3 100644 --- a/irods/test/query_test.py +++ b/irods/test/query_test.py @@ -115,7 +115,8 @@ def test_query_order_by(self): def test_query_order_by_desc(self): # query for user names - results = self.sess.query(User.name).order_by(User.name, order='desc').all() + results = self.sess.query(User.name).order_by( + User.name, order='desc').all() # get user names from results user_names = [] @@ -131,7 +132,8 @@ def test_query_order_by_desc(self): def test_query_order_by_invalid_param(self): with self.assertRaises(ValueError): - results = self.sess.query(User.name).order_by(User.name, order='moo').all() + results = self.sess.query(User.name).order_by( + User.name, order='moo').all() def test_query_strip(self): query = self.sess.query(Resource) diff --git a/irods/test/runner.py b/irods/test/runner.py index 1996f5da2b..3b89569860 100644 --- a/irods/test/runner.py +++ b/irods/test/runner.py @@ -23,7 +23,8 @@ suite = TestSuite(loader.discover(start_dir='.', pattern='*_test.py', top_level_dir=".")) - result = xmlrunner.XMLTestRunner(verbosity=2, output='test-reports').run(suite) + result = xmlrunner.XMLTestRunner( + verbosity=2, output='test-reports').run(suite) if result.wasSuccessful(): sys.exit(0) diff --git a/irods/test/unicode_test.py b/irods/test/unicode_test.py index 76fe819eec..bb282bb408 100644 --- a/irods/test/unicode_test.py +++ b/irods/test/unicode_test.py @@ -16,9 +16,6 @@ os.path.dirname(os.path.abspath(__file__)), 'unicode_sampler.xml') - - - def parse_xml_file(path): # parse xml document parser = ET.XMLParser(encoding='utf-8') diff --git a/irods/test/user_group_test.py b/irods/test/user_group_test.py index 0a3a19babb..8ff133f2d1 100644 --- a/irods/test/user_group_test.py +++ b/irods/test/user_group_test.py @@ -1,5 +1,6 @@ #! /usr/bin/env python -import os, sys +import os +import sys import unittest from irods.models import User from irods.session import iRODSSession @@ -21,7 +22,6 @@ def tearDown(self): ''' self.sess.cleanup() - def test_create_group(self): group_name = "test_group" @@ -81,10 +81,10 @@ def test_add_users_to_group(self): user = self.sess.users.get(test_user_name) group.removemember(user.name) user.remove() - + # delete group group.remove() - + # group should be gone with self.assertRaises(UserGroupDoesNotExist): self.sess.user_groups.get(group_name) diff --git a/irods/user.py b/irods/user.py index 445cfa83cb..dcabb2885e 100644 --- a/irods/user.py +++ b/irods/user.py @@ -1,6 +1,8 @@ from irods.models import User, UserGroup + class iRODSUser(object): + def __init__(self, manager, result=None): self.manager = manager if result: @@ -18,6 +20,7 @@ def remove(self): class iRODSUserGroup(object): + def __init__(self, manager, result=None): self.manager = manager if result: