def __init__(self, wsgidav_app, config): self.ccnet_threaded_rpc = ccnet.CcnetThreadedRpcClient( posixpath.join(CCNET_CONF_DIR, 'ccnet-rpc.sock')) self.session_cls = seahub_db.init_db_session_class()
raise ImportError( "Seaserv cannot be imported, because environment variable %s is undefined." % key) return None if _DEBUG: print("Loading %s from %s" % (key, v)) return os.path.normpath(os.path.expanduser(v)) CCNET_CONF_PATH = _load_path_from_env('CCNET_CONF_DIR') SEAFILE_CONF_DIR = _load_path_from_env('SEAFILE_CONF_DIR') SEAFILE_CENTRAL_CONF_DIR = _load_path_from_env('SEAFILE_CENTRAL_CONF_DIR', check=False) ccnet_pipe_path = os.path.join(CCNET_CONF_PATH, 'ccnet-rpc.sock') ccnet_threaded_rpc = ccnet.CcnetThreadedRpcClient(ccnet_pipe_path) seafile_pipe_path = os.path.join(SEAFILE_CONF_DIR, 'seafile.sock') seafserv_threaded_rpc = seafile.ServerThreadedRpcClient(seafile_pipe_path) # load ccnet server addr and port from ccnet.conf. # 'addr:port' is used when downloading a repo config = configparser.ConfigParser() config.read( os.path.join( SEAFILE_CENTRAL_CONF_DIR if SEAFILE_CENTRAL_CONF_DIR else CCNET_CONF_PATH, 'ccnet.conf')) if config.has_option('General', 'SERVICE_URL'): service_url = config.get('General', 'SERVICE_URL') hostname = urlparse(service_url).hostname
try: CCNET_CONF_PATH = os.environ[ENVIRONMENT_VARIABLES[0]] if not CCNET_CONF_PATH: # If it's set but is an empty string. raise KeyError except KeyError: raise ImportError( "Seaserv cannot be imported, because environment variable %s is undefined." % ENVIRONMENT_VARIABLES[0]) else: print "Loading ccnet config from " + CCNET_CONF_PATH CCNET_CONF_PATH = os.path.normpath(os.path.expanduser(CCNET_CONF_PATH)) pool = ccnet.ClientPool(CCNET_CONF_PATH) ccnet_rpc = ccnet.CcnetRpcClient(pool, req_pool=True) ccnet_threaded_rpc = ccnet.CcnetThreadedRpcClient(pool, req_pool=True) monitor_rpc = seafile.MonitorRpcClient(pool) seafserv_rpc = seafile.ServerRpcClient(pool, req_pool=True) seafserv_threaded_rpc = seafile.ServerThreadedRpcClient(pool, req_pool=True) # load ccnet server addr and port from ccnet.conf. # 'addr:port' is used when downloading a repo config = ConfigParser.ConfigParser() config.read(os.path.join(CCNET_CONF_PATH, 'ccnet.conf')) if config.has_option('General', 'SERVICE_URL') and \ config.has_option('Network', 'PORT'): service_url = config.get('General', 'SERVICE_URL') hostname = urlparse(service_url).hostname SERVICE_URL = service_url
def __init__(self): pool = ccnet.ClientPool(CCNET_CONF_DIR, central_config_dir=SEAFILE_CENTRAL_CONF_DIR) self.ccnet_threaded_rpc = ccnet.CcnetThreadedRpcClient(pool, req_pool=True) self.session_cls = seahub_db.init_db_session_class()
def __init__(self): import ccnet ccnet_dir = os.environ['CCNET_CONF_DIR'] central_config_dir = os.environ['SEAFILE_CENTRAL_CONF_DIR'] self.rpc_client = ccnet.CcnetThreadedRpcClient( ccnet.ClientPool(ccnet_dir, central_config_dir=central_config_dir))
def __init__(self): import ccnet ccnet_dir = os.environ['CCNET_CONF_DIR'] central_config_dir = os.environ['SEAFILE_CENTRAL_CONF_DIR'] ccnet_named_pipe_path = ccnet_dir + '/' + 'ccnet-rpc.sock' self.rpc_client = ccnet.CcnetThreadedRpcClient(ccnet_named_pipe_path)
def __init__(self): ccnet_conf_dir = os.path.normpath(os.path.expanduser(CCNET_CONF_DIR)) pool = ccnet.ClientPool(ccnet_conf_dir) self.ccnet_threaded_rpc = ccnet.CcnetThreadedRpcClient(pool, req_pool=True)
def __init__(self): pool = ccnet.ClientPool(CCNET_CONF_DIR, central_config_dir=SEAFILE_CENTRAL_CONF_DIR) self.ccnet_threaded_rpc = ccnet.CcnetThreadedRpcClient(pool, req_pool=True)
#!/usr/bin/env python #coding: UTF-8 import sys if len(sys.argv) != 3: print 'Usage: %s [email] [password]' % (sys.argv[0]) sys.exit(1) ccnet_dir = "{{ seafile_ccnet_config_dir }}" email = sys.argv[1] password = sys.argv[2] import ccnet rpc_client = ccnet.CcnetThreadedRpcClient(ccnet.ClientPool(ccnet_dir)) users = rpc_client.get_emailusers('DB', 0, 1) if len(users) != 0: print "Admin user already exists!" sys.exit(2) rpc_client.add_emailuser(email, password, 1, 1) lock = open('{{ seafile_home }}/seahub_admin_created.lock', 'w') lock.write('do not remove') lock.close()
def __init__(self): import ccnet ccnet_dir = os.environ['CCNET_CONF_DIR'] self.rpc_client = ccnet.CcnetThreadedRpcClient( ccnet.ClientPool(ccnet_dir))