예제 #1
0
파일: manage.py 프로젝트: boazin/backslash
def _run_deploy(dest, sudo=False, ask_sudo_pass=False):
    prepare_source_package()
    ansible = ensure_ansible()
    click.echo(click.style("Running deployment on {0!r}. This may take a while...".format(dest), fg='magenta'))

    if dest == "vagrant":
        # Vagrant will invoke ansible
        environ = os.environ.copy()
        environ["PATH"] = "{}:{}".format(os.path.dirname(ansible), environ["PATH"])
        # "vagrant up --provision" doesn't call provision if the virtual machine is already up,
        # so we have to call vagrant provision explicitly
        subprocess.check_call('vagrant up', shell=True, env=environ)
        subprocess.check_call('vagrant provision', shell=True, env=environ)
    else:
        cmd = [ansible, "-i",
               from_project_root("ansible", "inventories", dest)]
        if dest in ("localhost",):
            cmd.extend(["-c", "local"])
            if dest == "localhost":
                cmd.append("--sudo")

        if sudo:
            cmd.append('--sudo')

        if ask_sudo_pass:
            cmd.append('--ask-sudo-pass')

        cmd.append(from_project_root("ansible", "site.yml"))
        subprocess.check_call(cmd)
예제 #2
0
파일: manage.py 프로젝트: yaelmi3/backslash
def _run_tmux_frontend(port):
    tmuxp = os.path.join(os.path.dirname(sys.executable), 'tmuxp')
    os.execve(
        tmuxp, [tmuxp, 'load',
                from_project_root('_lib', 'frontend_tmux.yml')],
        dict(os.environ,
             TESTSERVER_PORT=str(port),
             CONFIG_DIRECTORY=from_project_root("conf.d")))
예제 #3
0
def _run_tmux_frontend(port):
    tmuxp = from_env_bin('tmuxp')
    os.execve(
        tmuxp, [tmuxp, 'load',
                from_project_root('_lib', 'frontend_tmux.yml')],
        dict(os.environ,
             TESTSERVER_PORT=str(port),
             CONFIG_DIRECTORY=from_project_root("conf.d")))
예제 #4
0
def deploy(dest, sudo, ask_sudo_pass, vagrant_machine, inventory):
    prepare_source_package()
    ansible = ensure_ansible()

    if dest == "vagrant":
        # Vagrant will invoke ansible
        environ = os.environ.copy()
        environ["PATH"] = "{}:{}".format(os.path.dirname(ansible),
                                         environ["PATH"])
        # "vagrant up --provision" doesn't call provision if the virtual machine is already up,
        # so we have to call vagrant provision explicitly
        click.echo(
            click.style(
                "Running deployment on Vagrant. This may take a while...",
                fg='magenta'))
        subprocess.check_call('vagrant up ' + vagrant_machine,
                              shell=True,
                              env=environ)
        subprocess.check_call('vagrant provision ' + vagrant_machine,
                              shell=True,
                              env=environ)
    else:
        if dest == "custom":
            if inventory is None:
                raise click.ClickException(
                    "-i/--inventory should be specified together with \"--dest custom\""
                )
            if not os.path.exists(inventory):
                raise click.ClickException(
                    "Custom inventory file {} doesn't exist".format(inventory))
        else:
            if inventory is not None:
                raise click.ClickException(
                    "-i/--inventory should be specified only when \"--dest custom\" is specified"
                )
            inventory = from_project_root("ansible", "inventories", dest)
        click.echo(
            click.style(
                "Running deployment on {}. This may take a while...".format(
                    inventory),
                fg='magenta'))
        cmd = [ansible, "-i", inventory]
        if dest in ("localhost", ):
            cmd.extend(["-c", "local"])
            if dest == "localhost":
                cmd.append("--sudo")

        if sudo:
            cmd.append('--sudo')

        if ask_sudo_pass:
            cmd.append('--ask-sudo-pass')

        cmd.append(from_project_root("ansible", "site.yml"))
        subprocess.check_call(cmd)
예제 #5
0
파일: manage.py 프로젝트: mvasilkov/dhcpawn
def _run_fulltest(extra_args=()):
    command = [from_env_bin("py.test")]
    if extra_args:
        command += list(extra_args)
    else:
        command += ["tests"]
    subprocess.check_call(command, cwd=from_project_root())
예제 #6
0
def testserver(tmux, livereload, port):
    if tmux:
        return _run_tmux_frontend(port=port)
    from flask_app.app import create_app

    extra_files = [from_project_root("flask_app", "app.yml")]

    app = create_app({
        'DEBUG': True,
        'TESTING': True,
        'SECRET_KEY': 'dummy',
        'SECURITY_PASSWORD_SALT': 'dummy'
    })
    logbook.StreamHandler(sys.stderr, level='DEBUG').push_application()
    logbook.compat.redirect_logging()

    if livereload:
        from livereload import Server
        s = Server(app)
        for filename in extra_files:
            s.watch(filename)
        s.watch('flask_app')
        for filename in ['webapp.js', 'vendor.js', 'webapp.css']:
            s.watch(os.path.join('static', 'assets', filename), delay=1)
        s.serve(port=port, liveport=35729)
    else:
        app.run(port=port, extra_files=extra_files)
예제 #7
0
파일: manage.py 프로젝트: mvasilkov/dhcpawn
def testserver():
    from flask_app.app import app
    app.config["DEBUG"] = True
    app.config["TESTING"] = True
    app.config["SECRET_KEY"] = "dummy secret key"
    app.run(port=8000, extra_files=[
        from_project_root("flask_app", "app.yml")
    ])
예제 #8
0
def testserver(tmux):
    if tmux:
        return _run_tmux_frontend()
    from flask_app.app import app
    app.config["DEBUG"] = True
    app.config["TESTING"] = True
    app.config["SECRET_KEY"] = "dummy secret key"
    app.run(port=8000, extra_files=[from_project_root("flask_app", "app.yml")])
예제 #9
0
파일: manage.py 프로젝트: yaelmi3/backslash
def _run_deploy(dest):
    prepare_source_package()
    cmd = [from_env_bin("python"), from_env_bin("ansible-playbook"), "-i"]
    click.echo(click.style(
        "Running deployment on {0!r}. This may take a while...".format(dest), fg='magenta'))

    cmd.append(from_project_root("ansible", "inventories", dest))
    if dest in ("localhost",):
        cmd.extend(["-c", "local"])
        if dest == "localhost":
            cmd.append("--sudo")
    cmd.append(from_project_root("ansible", "site.yml"))

    if dest == "vagrant":
        subprocess.check_call('vagrant up', shell=True)

        os.environ["ANSIBLE_HOST_KEY_CHECKING"] = 'false'
    subprocess.check_call(cmd)
예제 #10
0
파일: manage.py 프로젝트: yaelmi3/backslash
def testserver(tmux):
    if tmux:
        return _run_tmux_frontend()
    from flask_app.app import app
    app.config["DEBUG"] = True
    app.config["TESTING"] = True
    app.config["SECRET_KEY"] = "dummy secret key"
    app.run(port=8000, extra_files=[
        from_project_root("flask_app", "app.yml")
    ])
예제 #11
0
파일: manage.py 프로젝트: mvasilkov/dhcpawn
def _run_deploy(dest):
    prepare_source_package()
    ansible = ensure_ansible()
    click.echo(click.style("Running deployment on {0!r}. This may take a while...".format(dest), fg='magenta'))

    if dest == "vagrant":
        # Vagrant will invoke ansible
        environ = os.environ.copy()
        environ["PATH"] = "{}:{}".format(os.path.dirname(ansible), environ["PATH"])
        subprocess.check_call('vagrant up', shell=True, env=environ)
    else:
        cmd = [ansible, "-i",
               from_project_root("ansible", "inventories", dest)]
        if dest in ("localhost",):
            cmd.extend(["-c", "local"])
            if dest == "localhost":
                cmd.append("--sudo")
        cmd.append(from_project_root("ansible", "site.yml"))
        subprocess.check_call(cmd)
예제 #12
0
def testserver(livereload, port):
    from flask_app.app import create_app

    os.environ['CONFIG_DIRECTORY'] = from_project_root("conf.d")

    extra_files=[
        from_project_root("flask_app", "app.yml")
    ]

    app = create_app({'DEBUG': True, 'TESTING': True, 'SECRET_KEY': 'dummy'})
    if livereload:
        from livereload import Server
        s = Server(app)
        for filename in extra_files:
            s.watch(filename)
        s.watch('flask_app')
        s.serve(port=port, liveport=35729)
    else:
        app.run(port=port, extra_files=extra_files)
예제 #13
0
파일: manage.py 프로젝트: mvasilkov/dhcpawn
def _run_docker_start(port):
    persistent_dir = from_project_root('persistent')
    if not os.path.isdir(persistent_dir):
        os.makedirs(persistent_dir)
    db_container_name = _db_container_name()
    start_docker_container(image='postgres', name=db_container_name,
                           binds={os.path.join(persistent_dir, "db"):'/var/lib/postgresql/data'})
    container_name = _webapp_container_name()
    start_docker_container(image=APP_NAME, name=container_name, binds={persistent_dir:'/persistent'},
                           port_bindings={80: port},
                           links={db_container_name: 'db'})
예제 #14
0
def testserver(tmux, port):
    if tmux:
        return _run_tmux_frontend(port=port)
    from flask_app.app import create_app

    extra_files=[
        from_project_root("flask_app", "app.yml")
    ]

    app = create_app({'DEBUG': True, 'TESTING': True, 'SECRET_KEY': 'dummy', 'SECURITY_PASSWORD_SALT': 'dummy'})
    logbook.StreamHandler(sys.stderr, level='DEBUG').push_application()
    logbook.compat.redirect_logging()
    app.run(port=port, extra_files=extra_files, use_reloader=False)
예제 #15
0
def deploy(dest, sudo, ask_sudo_pass, vagrant_machine, inventory):
    prepare_source_package()
    ansible = ensure_ansible()

    if dest == "vagrant":
        # Vagrant will invoke ansible
        environ = os.environ.copy()
        environ["PATH"] = "{}:{}".format(os.path.dirname(ansible), environ["PATH"])
        # "vagrant up --provision" doesn't call provision if the virtual machine is already up,
        # so we have to call vagrant provision explicitly
        click.echo(click.style("Running deployment on Vagrant. This may take a while...", fg='magenta'))
        subprocess.check_call('vagrant up ' + vagrant_machine, shell=True, env=environ)
        subprocess.check_call('vagrant provision ' + vagrant_machine, shell=True, env=environ)
    else:
        if dest == "custom":
            if inventory is None:
                raise click.ClickException("-i/--inventory should be specified together with \"--dest custom\"")
            if not os.path.exists(inventory):
                raise click.ClickException("Custom inventory file {} doesn't exist".format(inventory))
        else:
            if inventory is not None:
                raise click.ClickException("-i/--inventory should be specified only when \"--dest custom\" is specified")
            inventory = from_project_root("ansible", "inventories", dest)
        click.echo(click.style("Running deployment on {}. This may take a while...".format(inventory), fg='magenta'))
        cmd = [ansible, "-i", inventory]
        if dest in ("localhost",):
            cmd.extend(["-c", "local"])
            if dest == "localhost":
                cmd.append("--sudo")

        if sudo:
            cmd.append('--sudo')

        if ask_sudo_pass:
            cmd.append('--ask-sudo-pass')

        cmd.append(from_project_root("ansible", "site.yml"))
        subprocess.check_call(cmd)
예제 #16
0
def _run_deploy(dest, sudo=False, ask_sudo_pass=False):
    prepare_source_package()
    ansible = ensure_ansible()
    click.echo(
        click.style(
            "Running deployment on {0!r}. This may take a while...".format(
                dest),
            fg='magenta'))

    if dest == "vagrant":
        # Vagrant will invoke ansible
        environ = os.environ.copy()
        environ["PATH"] = "{}:{}".format(os.path.dirname(ansible),
                                         environ["PATH"])
        # "vagrant up --provision" doesn't call provision if the virtual machine is already up,
        # so we have to call vagrant provision explicitly
        subprocess.check_call('vagrant up', shell=True, env=environ)
        subprocess.check_call('vagrant provision', shell=True, env=environ)
    else:
        cmd = [
            ansible, "-i",
            from_project_root("ansible", "inventories", dest)
        ]
        if dest in ("localhost", ):
            cmd.extend(["-c", "local"])
            if dest == "localhost":
                cmd.append("--sudo")

        if sudo:
            cmd.append('--sudo')

        if ask_sudo_pass:
            cmd.append('--ask-sudo-pass')

        cmd.append(from_project_root("ansible", "site.yml"))
        subprocess.check_call(cmd)
예제 #17
0
파일: manage.py 프로젝트: yaelmi3/backslash
def testserver(tmux, port):
    if tmux:
        return _run_tmux_frontend(port=port)
    from flask_app.app import create_app

    extra_files = [from_project_root("flask_app", "app.yml")]

    app = create_app({
        'DEBUG': True,
        'TESTING': True,
        'SECRET_KEY': 'dummy',
        'SECURITY_PASSWORD_SALT': 'dummy'
    })
    logbook.StreamHandler(sys.stderr, level='DEBUG').push_application()
    logbook.compat.redirect_logging()
    app.run(port=port, extra_files=extra_files, use_reloader=False)
예제 #18
0
def testserver(tmux, livereload, port):
    if tmux:
        return _run_tmux_frontend(port=port)
    from flask_app.app import create_app

    extra_files=[
        from_project_root("flask_app", "app.yml")
    ]

    app = create_app({'DEBUG': True, 'TESTING': True, 'SECRET_KEY': 'dummy', 'SECURITY_PASSWORD_SALT': 'dummy'})
    if livereload:
        from livereload import Server
        s = Server(app)
        for filename in extra_files:
            s.watch(filename)
        s.watch('flask_app')
        logbook.StreamHandler(sys.stderr, level='DEBUG').push_application()
        s.serve(port=port, liveport=35729)
    else:
        app.run(port=port, extra_files=extra_files)
예제 #19
0
def testserver(tmux, livereload, port):
    if tmux:
        return _run_tmux_frontend(port=port)
    from flask_app.app import create_app

    extra_files = [from_project_root("flask_app", "app.yml")]

    app = create_app({
        'DEBUG': True,
        'TESTING': True,
        'SECRET_KEY': 'dummy',
        'SECURITY_PASSWORD_SALT': 'dummy'
    })
    if livereload:
        from livereload import Server
        s = Server(app)
        for filename in extra_files:
            s.watch(filename)
        s.watch('flask_app')
        logbook.StreamHandler(sys.stderr, level='DEBUG').push_application()
        s.serve(port=port, liveport=35729)
    else:
        app.run(port=port, extra_files=extra_files)
예제 #20
0
def testserver(tmux, livereload, port):
    if tmux:
        return _run_tmux_frontend(port=port)
    from flask_app.app import create_app

    extra_files=[
        from_project_root("flask_app", "app.yml")
    ]

    app = create_app({'DEBUG': True, 'TESTING': True, 'SECRET_KEY': 'dummy', 'SECURITY_PASSWORD_SALT': 'dummy'})
    if livereload:
        from livereload import Server
        s = Server(app)
        for filename in extra_files:
            s.watch(filename)
        s.watch('flask_app')
        for filename in ['webapp.js', 'vendor.js', 'webapp.css']:
            s.watch(os.path.join('static', 'assets', filename), delay=1)
        logbook.StreamHandler(sys.stderr, level='DEBUG').push_application()
        logbook.compat.redirect_logging()
        s.serve(port=port, liveport=35729)
    else:
        app.run(port=port, extra_files=extra_files)
예제 #21
0
def _run_pytest(pytest_args=()):
    subprocess.check_call(
        [sys.executable, '-m', "pytest"]+list(pytest_args), cwd=from_project_root())
예제 #22
0
파일: manage.py 프로젝트: boazin/backslash
def _run_tmux_frontend():
    tmuxp = from_env_bin('tmuxp')
    os.execv(tmuxp, [tmuxp, 'load', from_project_root('_lib', 'frontend_tmux.yml')])
예제 #23
0
def _run_docker_start(port):
    persistent_dir = from_project_root('persistent')
    if not os.path.isdir(persistent_dir):
        os.makedirs(persistent_dir)
    start_docker_container(persistent_dir=persistent_dir,
                           port_bindings={80: port})
예제 #24
0
def _run_pytest(pytest_args=()):
    subprocess.check_call(
        [from_env_bin("py.test")]+list(pytest_args), cwd=from_project_root())
예제 #25
0
def _run_tmux_frontend(port):
    tmuxp = from_env_bin('tmuxp')
    os.execve(tmuxp, [tmuxp, 'load', from_project_root('_lib', 'frontend_tmux.yml')], dict(os.environ, TESTSERVER_PORT=str(port), CONFIG_DIRECTORY=from_project_root("conf.d")))
예제 #26
0
def _run_tmux_frontend(port):
    tmuxp = os.path.join(os.path.dirname(sys.executable), 'tmuxp')
    os.execve(tmuxp, [tmuxp, 'load', from_project_root('_lib', 'frontend_tmux.yml')], dict(os.environ, TESTSERVER_PORT=str(port), CONFIG_DIRECTORY=from_project_root("conf.d")))
예제 #27
0
파일: manage.py 프로젝트: yaelmi3/backslash
def _run_unittest():
    subprocess.check_call([
        sys.executable, '-m', "pytest", "tests/", "--cov=flask_app",
        "--cov-report=html"
    ],
                          cwd=from_project_root())
예제 #28
0
def _run_fulltest(extra_args=()):
    subprocess.check_call([sys.executable, '-m', "pytest", "tests"]
                          + list(extra_args), cwd=from_project_root())
예제 #29
0
def _run_docker_build():
    prepare_source_package()
    build_docker_image(tag=APP_NAME, root=from_project_root())
예제 #30
0
파일: manage.py 프로젝트: boazin/backslash
def build():
    build_docker_image(tag=APP_NAME, root=from_project_root())
예제 #31
0
파일: manage.py 프로젝트: getslash/scotty
def _run_slash(slash_args=()):
    subprocess.check_call(
        [from_env_bin("slash"), "run"]+list(slash_args), cwd=from_project_root())
예제 #32
0
파일: manage.py 프로젝트: mvasilkov/dhcpawn
def _run_docker_build():
    prepare_source_package()
    build_docker_image(tag=APP_NAME, root=from_project_root())
예제 #33
0
파일: manage.py 프로젝트: yaelmi3/backslash
def _run_pytest(pytest_args=()):
    subprocess.check_call([sys.executable, '-m', "pytest"] + list(pytest_args),
                          cwd=from_project_root())
예제 #34
0
def _run_unittest():
    subprocess.check_call(
        [sys.executable, '-m', "pytest", "tests/", "--cov=flask_app", "--cov-report=html"], cwd=from_project_root())
예제 #35
0
파일: manage.py 프로젝트: yaelmi3/backslash
def _run_fulltest(extra_args=()):
    subprocess.check_call([sys.executable, '-m', "pytest", "tests"] +
                          list(extra_args),
                          cwd=from_project_root())
예제 #36
0
def _run_tmux_frontend():
    tmuxp = from_env_bin('tmuxp')
    os.execv(tmuxp,
             [tmuxp, 'load',
              from_project_root('_lib', 'frontend_tmux.yml')])
예제 #37
0
def _run_unittest():
    subprocess.check_call(
        [from_env_bin("py.test"), "tests/test_ut"], cwd=from_project_root())
예제 #38
0
def _run_unittest():
    subprocess.check_call(
        [from_env_bin("py.test"), "tests/", "--cov=flask_app", "--cov-report=html"], cwd=from_project_root())
예제 #39
0
def _run_unittest():
    subprocess.check_call(
        [from_env_bin("py.test"), "tests/", "--cov=flask_app", "--cov-report=html"], cwd=from_project_root())
예제 #40
0
def _run_unittest():
    subprocess.check_call(
        [from_env_bin("py.test"), "tests/test_ut"], cwd=from_project_root())
예제 #41
0
def _run_pytest(pytest_args=()):
    subprocess.check_call(
        [from_env_bin("py.test")]+list(pytest_args), cwd=from_project_root())
예제 #42
0
def _run_fulltest(extra_args=()):
    subprocess.check_call([from_env_bin("py.test"), "tests"]
                          + list(extra_args), cwd=from_project_root())
예제 #43
0
def _run_fulltest(extra_args=()):
    subprocess.check_call([from_env_bin("py.test"), "tests"]
                          + list(extra_args), cwd=from_project_root())
예제 #44
0
파일: manage.py 프로젝트: boazin/backslash
def _run_docker_start(port):
    persistent_dir = from_project_root('persistent')
    if not os.path.isdir(persistent_dir):
        os.makedirs(persistent_dir)
    start_docker_container(persistent_dir=persistent_dir, port_bindings={80: port})
예제 #45
0
def _run_slash(slash_args=()):
    subprocess.check_call([from_env_bin("slash"), "run"] + list(slash_args),
                          cwd=from_project_root())