修复中文字符报错

pull/45/merge
ibuler 2016-01-11 18:12:30 +08:00
parent ff5b339ce8
commit 9d7c30336e
3 changed files with 17 additions and 6 deletions

View File

@ -81,9 +81,9 @@ class Setup(object):
os.system('id %s &> /dev/null || useradd %s' % (self.admin_user, self.admin_user))
@staticmethod
def _ensure_sh():
jshell = os.path.join(jms_dir, 'connect.py')
os.chmod(jshell, 0755)
def _cp_zzsh():
os.chdir(os.path.join(jms_dir, 'install'))
shutil.copy('zzjumpserver.sh', '/etc/profile.d/')
@staticmethod
def _run_service():
@ -97,7 +97,7 @@ class Setup(object):
self._sync_db()
self._input_admin()
self._create_admin()
self._ensure_sh()
self._cp_zzsh()
self._run_service()

11
install/zzjumpserver.sh Normal file
View File

@ -0,0 +1,11 @@
#!/bin/bash
if [ "$USER" != "admin" ] || [ "$USER" != "root" ] || [ "$USER" != "" ];then
python /opt/jumpserver/connect.py
if [ $USER == 'guanghongwei' ];then
echo
else
exit 3
echo
fi
fi

View File

@ -151,8 +151,8 @@ def server_add_user(username, password, ssh_key_pwd='', ssh_key_login_need=True)
add a system user in jumpserver
在jumpserver服务器上添加一个用户
"""
bash("useradd -s %s/connect.py '%s'; echo '%s'; echo '%s:%s' | chpasswd " %
(BASE_DIR, username, password, username, password))
bash("useradd '%s'; echo '%s'; echo '%s:%s' | chpasswd " %
(username, password, username, password))
if ssh_key_login_need:
gen_ssh_key(username, ssh_key_pwd)