From 0715e11c0548767db5c108b353ac1b8ed81120c2 Mon Sep 17 00:00:00 2001 From: ibuler Date: Fri, 18 Dec 2015 18:35:07 +0800 Subject: [PATCH] fix install bug --- install/next.py | 12 ++++++++---- jumpserver.conf | 13 ++++++------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/install/next.py b/install/next.py index a7765749f..272847b58 100644 --- a/install/next.py +++ b/install/next.py @@ -14,7 +14,7 @@ os.environ['DJANGO_SETTINGS_MODULE'] = 'jumpserver.settings' if django.get_version() != '1.6': setup = django.setup() -from juser.user_api import db_add_user, server_add_user +from juser.user_api import db_add_user, get_object, User from install import color_print @@ -25,7 +25,7 @@ class Setup(object): def __init__(self): self.admin_user = 'admin' - self.admin_pass = 'Lov@wife' + self.admin_pass = '5Lov@wife' def _input_admin(self): while True: @@ -54,18 +54,22 @@ class Setup(object): execute_from_command_line(['manage.py', 'syncdb', '--noinput']) def _create_admin(self): + user = get_object(User, username=self.admin_user) + if user: + user.delete() db_add_user(username=self.admin_user, password=self.admin_pass, role='SU', name='admin', groups='', admin_groups='', email='admin@jumpserver.org', uuid='MayBeYouAreTheFirstUser', is_active=True) - os.system('id %s || useradd %s' % (self.admin_user, self.admin_user)) + os.system('id %s &> /dev/null || useradd %s' % (self.admin_user, self.admin_user)) @staticmethod def _cp_zzsh(): - os.chdir(jms_dir) + os.chdir(os.path.join(jms_dir, 'install')) shutil.copy('zzjumpserver.sh', '/etc/profile.d/') @staticmethod def _run_service(): os.system('sh %s start' % os.path.join(jms_dir, 'service.sh')) + print color_print('安装成功,请访问web .') def start(self): diff --git a/jumpserver.conf b/jumpserver.conf index 68f9561f0..e5f15d738 100644 --- a/jumpserver.conf +++ b/jumpserver.conf @@ -1,7 +1,5 @@ -#coding: utf8 - [base] -url = http://j +url = http://192.168.244.129 key = 88aaaf7ffe3c6c04 log = debug @@ -13,12 +11,13 @@ password = mysql234 database = jumpserver [websocket] -web_socket_host = j:3000 +web_socket_host = 192.168.244.129:3000 [mail] mail_enable = 1 -email_host = smtp.exmail.qq.com +email_host = smtp.qq.com email_port = 25 -email_host_user = noreply@jumpserver.org -email_host_password = jumpserver1234 +email_host_user = ibuler@qq.com +email_host_password = Hudie117...qq email_use_tls = True +