Skip to content

Commit

Permalink
Merge pull request #278 from haiwen/fix_ccnet_init
Browse files Browse the repository at this point in the history
Fix the arguments of ccnet init.
  • Loading branch information
killing committed Oct 23, 2019
2 parents cafce2b + 171895d commit 6a428da
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 50 deletions.
2 changes: 0 additions & 2 deletions ci/serverctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ def init_ccnet(self):
self.central_conf_dir,
'-c',
self.ccnet_conf_dir,
'--name',
'test',
'--host',
'test.seafile.com',
]
Expand Down
4 changes: 2 additions & 2 deletions python/seaserv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
from .service import get_related_users_by_repo, get_related_users_by_org_repo
from .service import post_empty_file, del_file

from .service import CCNET_CONF_PATH, CCNET_SERVER_ADDR, CCNET_SERVER_PORT, \
from .service import CCNET_CONF_PATH, CCNET_SERVER_ADDR, \
MAX_UPLOAD_FILE_SIZE, MAX_DOWNLOAD_DIR_SIZE, FILE_SERVER_ROOT, \
CALC_SHARE_USAGE, SERVICE_URL, FILE_SERVER_PORT, SERVER_ID, \
CALC_SHARE_USAGE, SERVICE_URL, FILE_SERVER_PORT, \
SEAFILE_CENTRAL_CONF_DIR, LDAP_HOST

from .service import send_message
Expand Down
1 change: 0 additions & 1 deletion scripts/setup-seafile-mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,6 @@ def generate(self):
ccnet_init,
'-F', env_mgr.central_config_dir,
'--config-dir', self.ccnet_dir,
'--name', self.server_name,
'--host', self.ip_or_domain,
]

Expand Down
1 change: 0 additions & 1 deletion scripts/setup-seafile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,6 @@ if [[ "${use_existing_ccnet}" != "true" ]]; then
if ! LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH "${ccnet_init}" \
-F "${default_conf_dir}" \
-c "${default_ccnet_conf_dir}" \
--name "${server_name}" \
--host "${ip_or_domain}"; then
err_and_quit;
fi
Expand Down
44 changes: 0 additions & 44 deletions tools/seafile-admin
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ SCRIPT_NAME = os.path.basename(sys.argv[0])
PYTHON = sys.executable

conf = {}
CONF_SERVER_NAME = 'server_name'
CONF_CCNET_DIR = 'ccnet_dir'
CONF_SEAFILE_DIR = 'seafile_dir'
CONF_SEAHUB_DIR = 'seafile_dir'
CONF_CCNET_PORT = 'ccnet_port'
CONF_SEAFILE_PORT = 'seafile_port'
CONF_FILESERVER_PORT = 'fileserver_port'
CONF_IP_OR_DOMAIN = 'ip_or_domain'
Expand Down Expand Up @@ -304,21 +302,6 @@ Press [ENTER] to continue
print welcome_msg
raw_input()


def get_server_name():
def validate(name):
r = re.compile(r'^[\w]{3,15}$')
return bool(r.match(name))

question = 'What is the name of the server?'
key = 'server name'
note = '3 - 15 letters or digits'
conf[CONF_SERVER_NAME] = ask_question(question,
key=key,
note=note,
validate=validate)


def get_server_ip_or_domain():
def validate(s):
r = r'^[^.].+\..+[^.]$'
Expand Down Expand Up @@ -352,24 +335,6 @@ def get_ccnet_conf_dir():
conf[CONF_CCNET_DIR] = ccnet_conf_dir


def get_ccnet_port():
def validate(s):
try:
port = int(s)
except ValueError:
return False

return port > 0 and port < 65536

question = 'Which port do you want to use for the ccnet server?'
key = 'ccnet server port'
default = '10001'
conf[CONF_CCNET_PORT] = ask_question(question,
key=key,
default=default,
validate=validate)


def get_seafile_port():
def validate(s):
try:
Expand Down Expand Up @@ -568,9 +533,7 @@ def check_python_dependencies(silent=False):
def config_ccnet_seafile():
get_ccnet_conf_dir()
if not conf[CONF_CCNET_CONF_EXISTS]:
get_server_name()
get_server_ip_or_domain()
get_ccnet_port()

get_seafile_data_dir()
if not conf[CONF_SEAFILE_CONF_EXISTS]:
Expand All @@ -584,11 +547,8 @@ def config_ccnet_seafile():
highlight(conf[CONF_CCNET_DIR]))
else:
info('ccnet conf dir: %s' % highlight(conf[CONF_CCNET_DIR]))
info('server name: %s' %
highlight(conf[CONF_SERVER_NAME]))
info('server host: %s' %
highlight(conf[CONF_IP_OR_DOMAIN]))
info('ccnet port: %s' % highlight(conf[CONF_CCNET_PORT]))

if conf[CONF_SEAFILE_CONF_EXISTS]:
info('seafile: use existing config in %s' %
Expand Down Expand Up @@ -619,10 +579,6 @@ def init_ccnet_seafile():
conf[CONF_SEAFILE_CENTRAL_CONF_DIR],
'-c',
conf[CONF_CCNET_DIR],
'--name',
conf[CONF_SERVER_NAME],
'--port',
conf[CONF_CCNET_PORT],
'--host',
conf[CONF_IP_OR_DOMAIN],
]
Expand Down

0 comments on commit 6a428da

Please sign in to comment.