Exemplo n.º 1
0
 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')
Exemplo n.º 2
0
    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
Exemplo n.º 3
0
 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
Exemplo n.º 4
0
 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
Exemplo n.º 5
0
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')
Exemplo n.º 6
0
 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)
Exemplo n.º 7
0
 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)
Exemplo n.º 8
0
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()
Exemplo n.º 9
0
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()
Exemplo n.º 10
0
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()
Exemplo n.º 11
0
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()
Exemplo n.º 12
0
 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
Exemplo n.º 13
0
Arquivo: next.py Projeto: cmbops/opsap
    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
Exemplo n.º 14
0
 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')
Exemplo n.º 15
0
 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')
Exemplo n.º 16
0
 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')
Exemplo n.º 17
0
Arquivo: next.py Projeto: cmbops/opsap
 def _run_service():
     os.system('sh %s start' % os.path.join(BASE_DIR, 'service.sh'))
     print
     color_print('安装成功,请访问web页面, 祝您使用愉快!', 'green')
Exemplo n.º 18
0
 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')
Exemplo n.º 19
0
 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')
Exemplo n.º 20
0
    #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:
Exemplo n.º 21
0
 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')
Exemplo n.º 22
0
 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')
Exemplo n.º 23
0
Arquivo: next.py Projeto: cmbops/opsap
 def _run_service():
     os.system('sh %s start' % os.path.join(BASE_DIR, 'service.sh'))
     print
     color_print('安装成功,请访问web页面, 祝您使用愉快!', 'green')
Exemplo n.º 24
0
 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')