Exemple #1
0
    def get_fs(cls, registry, fs_name, fs_name_params, fs_path, writeable, create_dir):
        from fs.rpcfs import RPCFS
        _username, _password, fs_path = _parse_credentials(fs_path)
        if '://' not in fs_path:
            fs_path = 'http://' + fs_path

        scheme, netloc, path, _params, _query, _fragment = urlparse(fs_path)

        rpcfs = RPCFS('%s://%s' % (scheme, netloc))

        if create_dir and path:
            rpcfs.makedir(path, recursive=True, allow_recreate=True)

        return rpcfs, path or None
Exemple #2
0
    def get_fs(cls, registry, fs_name, fs_name_params, fs_path, writeable, create_dir):
        from fs.rpcfs import RPCFS             
        _username, _password, fs_path = _parse_credentials(fs_path)
        if '://' not in fs_path:
            fs_path = 'http://' + fs_path
            
        scheme, netloc, path, _params, _query, _fragment = urlparse(fs_path)

        rpcfs = RPCFS('%s://%s' % (scheme, netloc))
        
        if create_dir and path:
            rpcfs.makedir(path, recursive=True, allow_recreate=True)
                
        return rpcfs, path or None
def _cache_init():
    if TALLY_CACHE.startswith('rpc://'):
        try:
            l_cache_fs = RPCFS('http://' + TALLY_CACHE[len('rpc://'):])
        except RemoteConnectionError:
            return None
    else:
        l_cache_fs = fsopendir(TALLY_CACHE, create_dir=True)
    return l_cache_fs
Exemple #4
0
def _wallet_init():
    if DOCUMENT_WALLET_ROOT.startswith('rpc://'):
        try:
            l_wallet_fs = RPCFS('http://' + DOCUMENT_WALLET_ROOT[len('rpc://'):])
        except RemoteConnectionError:
            lpath = os.path.join(INSTANCE_ROOT, 'wallet')
            logger.error('Could not connect to configured DOCUMENT_WALLET. '
                         'Using {0}.'.format(lpath))
            l_wallet_fs = fsopendir(lpath, create_dir=True)
    else:
        l_wallet_fs = fsopendir(DOCUMENT_WALLET_ROOT, create_dir=True)
    return l_wallet_fs
Exemple #5
0
def _refdocs_init():
    if REFDOC_ROOT.startswith('rpc://'):
        try:
            l_refdoc_fs = RPCFS('http://' + REFDOC_ROOT[len('rpc://'):])
        except RemoteConnectionError:
            lpath = os.path.join(INSTANCE_ROOT, 'refdocs')
            logger.error('Could not connect to configured REFDOCS. '
                         'Using {0}.'.format(lpath))
            l_refdoc_fs = fsopendir(lpath, create_dir=True)
    else:
        l_refdoc_fs = fsopendir(REFDOC_ROOT, create_dir=True)
    return l_refdoc_fs