def _run_service(): cmd = 'bash %s start' % os.path.join(jms_dir, 'service.sh') shlex.os.system(cmd) print color_print( '安装成功,请访问web, 祝你使用愉快。\n请访问 https://github.com/jumpserver/jumpserver/wiki 查看文档', 'green')
def _input_admin(self): while True: print admin_user = raw_input('请输入管理员用户名 [%s]: ' % self.admin_user).strip() admin_user = raw_input('请输入管理员邮箱 [%s]: ' % self.admin_email).strip() admin_pass = raw_input('请输入管理员密码: [%s]: ' % self.admin_pass).strip() admin_pass_again = raw_input('请再次输入管理员密码: [%s]: ' % self.admin_pass).strip() if admin_user: self.admin_user = admin_user if admin_email: self.admin_email = admin_email if not admin_pass_again: admin_pass_again = self.admin_pass if admin_pass: self.admin_pass = admin_pass if self.admin_pass != admin_pass_again: color_print('两次密码不相同请重新输入') else: break print
def _pull(): color_print('开始更新jumpserver', 'green') # bash('git pull') try: mac = get_mac_address() version = urllib.urlopen('http://jumpserver.org/version/?id=%s' % mac) except: pass
def _pull(): color_print('开始更新极云监控', 'green') # bash('git pull') try: mac = get_mac_address() version = urllib.urlopen('http://jumpserver.org/version/?id=%s' % mac) except: pass
def alter(filename): print(filename) with open(filename, 'r') as file: data = file.read() new = data.replace('MySQLdb', 'pymysql') with open(filename, 'w') as file: file.write(new) color_print('修改成功', 'green')
def _pull(): color_print('开始更新Utopia', 'green') # bash('git pull') try: mac = get_mac_address() version = urllib.urlopen('http://utopia.org/version/?id=%s' % mac) except: pass os.chdir(jms_dir) os.chmod('logs', 0777)
def install_packages_with_conda(dependencies_list): install_instructions = dict() if sys.platform.startswith("win") or "nt" in os.name: # you run windows install_instructions = INSTALL_WINDODWS elif "posix" in os.name: # you run linux/macos install_instructions = INSTALL_LINUX color_print( "To install dependency '%s' please run:\n %s" % (dependencies_list[0], install_instructions[dependencies_list[0]]), FOREGROUND.RED) sys.exit()
def add_anaconda_to_path_win(path): """ only for windows search for anaconda on the PC try to add it's path to PYTHONPATH and import dependencies again if it failes - it instruct the user what to do next """ # if anaconda was found, try to add it to path and import dependencies anaconda_python = os.path.join(path, "python") color_print( "\nYou have Anaconda installed but you are not running it's python, please run:\n\n%s %s" % (anaconda_python, " ".join(sys.argv)), FOREGROUND.RED) sys.exit()
def install_without_anaconda(): if sys.platform.startswith( "win" ) or "nt" in os.name: # you run windows, we dont know to install dependencie sthere color_print(INSTALL_ANACONDA + " " + TROUBLESHOOT, FOREGROUND.RED) sys.exit() elif sys.platform.startswith("lin") or "posix" in os.name: # you run linux # install dependencis that are not installed not_installed = check_dependencies( GLINT_OBLIGATORY_DEPENDENCIES_NO_CONDA + GLINT_OBLIGATORY_DEPENDENCIES_WITH_CONDA) if not_installed == []: # we succeeded to install all dependencies print("Dependencies are installed") return True color_print(INSTALL_ANACONDA + " " + TROUBLESHOOT, FOREGROUND.RED) sys.exit()
def run_me_with_anaconda(): if sys.platform.startswith("win") or "nt" in os.name: # you run windows path = os.path.dirname(conda_path) last_path = "" while last_path != path and "conda" not in os.path.basename( path).lower(): last_path = path path = os.path.dirname(path) add_anaconda_to_path_win(path) elif "posix" in os.name: # you run linux/macos add_anaconda_to_path_lin(conda_path) else: color_print( "You have Anaconda installed but you are not running it's python " + TROUBLESHOOT, FOREGROUND.RED) sys.exit()
def _pull(): color_print('更新sshweb', 'green') #应该是记录安装jumpserver的主机数目 # bash('git pull') try: mac = get_mac_address() ''' def get_mac_address(): node = uuid.getnode() mac = uuid.UUID(int=node).hex[-12:] return mac ''' version = urllib.urlopen( 'http://jumpserver.org/version/?id=wsjisuhwgyuxwyu') except: pass
def _input_admin(self): while True: print admin_user = raw_input('请输入管理员用户名 [%s]: ' % self.admin_user).strip() admin_pass = raw_input('请输入管理员密码: [%s]: ' % self.admin_pass).strip() admin_pass_again = raw_input('请再次输入管理员密码: [%s]: ' % self.admin_pass).strip() if admin_user: self.admin_user = admin_user if not admin_pass_again: admin_pass_again = self.admin_pass if admin_pass: self.admin_pass = admin_pass if self.admin_pass != admin_pass_again: color_print('两次密码不相同请重新输入') else: break print
def _run_service(): os.system('sh %s start' % os.path.join(jms_dir, 'service.sh')) print color_print( '安装成功,请访问web, 祝你使用愉快。\n请访问 https://github.com/ibuler/jumpserver 查看文档', 'green')
def _run_service(): cmd = 'bash %s start' % os.path.join(jms_dir, 'service.sh') shlex.os.system(cmd) print color_print('安装成功,Web登录请访问http://ip:8000, 祝你使用愉快。\n', 'green')
def _run_service(): cmd = 'bash %s start' % os.path.join(jms_dir, 'service.sh') shlex.os.system(cmd) print color_print('安装成功,Web登录请访问http://ip:8000, 祝你使用愉快。\n请访问 https://github.com/jumpserver/jumpserver/wiki 查看文档', 'green')
def _run_service(): os.system('sh %s start' % os.path.join(BASE_DIR, 'service.sh')) print color_print('安装成功,请访问web页面, 祝您使用愉快!', 'green')
def _run_service(): os.system('sh %s start' % os.path.join(jms_dir, 'service.sh')) print color_print('安装成功,请访问web, 祝你使用愉快。\n请访问 https://utopia.org/davidey/utopia 查看文档', 'green')
def _run_service(): os.system('sh %s start' % os.path.join(jms_dir, 'service.sh')) print color_print( '安装成功,请访问web, 祝你使用愉快。\n请访问 https://utopia.org/davidey/utopia 查看文档', 'green')
#from now code assumes anaconda is installes # see if we are running anaconda python anaconda_dir = os.path.dirname(conda_path).lower() if anaconda_dir in sys.executable.lower() or os.path.dirname( anaconda_dir) in sys.executable.lower(): print("You are now running Anaconda Python") try: for pkg in GLINT_OBLIGATORY_DEPENDENCIES_WITH_CONDA: import_dependencies([pkg]) except: # something is wrong since we are missing dependencies that included in anaconda color_print( "There was a problem with the dependency %s, " % pkg + TROUBLESHOOT, FOREGROUND.RED) sys.exit() try: import_dependencies(GLINT_OBLIGATORY_DEPENDENCIES_NO_CONDA) except: print("Some dependencies are missing") success = install_packages_with_conda( GLINT_OBLIGATORY_DEPENDENCIES_NO_CONDA) if not success: color_print("Could not install dependencies, ", TROUBLESHOOT, FOREGROUND.RED) sys.exit() else:
def _run_service(): os.system('sh %s start' % os.path.join(jms_dir, 'service.sh')) print color_print('安装成功,请访问web, 祝你使用愉快。\n请访问 https://github.com/ibuler/jumpserver 查看文档', 'green')
def _run_service(): cmd = 'sudo python %s &' % os.path.join(jms_dir, 'run_server.py') shlex.os.system(cmd) print color_print('PUSHELL 安装成功,Web登录请访问http://ip:3721, 祝你使用愉快', 'green')