예제 #1
0
def _create_new_release_dir(owner, base_dir):
    date_dir = datetime.utcnow().strftime('%Y%m%d%H%M%S')
    release_dir = os.path.join(base_dir, date_dir)

    with ctx.sudo(owner):
        dir.create(release_dir)

    return release_dir
예제 #2
0
    def _layout(self):
        current_user = core.run("echo $USER").stdout

        for type, path in self.folders.iteritems():
            if not dir.exists(path):
                if type != "current":
                    dir.create(path, recursive=True)
            else:
                with ctx.sudo():
                    dir.attributes(path, owner=current_user, recursive=True)
예제 #3
0
    def _layout(self):
        current_user = core.run("echo $USER").stdout

        for type, path in self.folders.iteritems():
            if not dir.exists(path):
                if type != "current":
                    dir.create(path, recursive=True)
            else:
                with ctx.sudo():
                    dir.attributes(path, owner=current_user, recursive=True)
예제 #4
0
파일: mysql.py 프로젝트: 5monkeys/revolver
def _preseed_server(root_password):
    seed_config = """# Mysql preseed generated by revolver
mysql-server mysql-server/root_password password %(root_password)s
mysql-server mysql-server/root_password_again password %(root_password)s 
""" % {"root_password": root_password}
    seed_dir = "/var/cache/local/preseeding/"
    seed_file = seed_dir + "mysql-server.seed"

    with ctx.sudo():
        dir.create(seed_dir, recursive=True)
        file.write(seed_file, seed_config)
        sudo("debconf-set-selections %s" % seed_file)
예제 #5
0
def install():
    package.ensure(["curl", "git-core"])

    url = "https://raw.github.com/CHH/phpenv/master/bin/phpenv-install.sh"
    if not dir.exists(".phpenv"):
        run("curl -s %s | bash" % url)
    else:
        run("curl -s %s | UPDATE=yes bash" % url)

    dir.create(".phpenv/versions")

    _ensure_autoload(".bashrc")
    _ensure_autoload(".zshrc")
예제 #6
0
def install():
    package.ensure(["curl", "git-core"])

    if not dir.exists(".php-build"):
        core.run("git clone git://github.com/CHH/php-build .php-build")

    with ctx.cd(".php-build"):
        core.run("git pull")
        dir.create("versions")
        dir.create("tmp")

    _ensure_autoload(".bashrc")
    _ensure_autoload(".zshrc")
예제 #7
0
def _preseed_server(root_password):
    seed_config = """# Mysql preseed generated by revolver
mysql-server mysql-server/root_password password %(root_password)s
mysql-server mysql-server/root_password_again password %(root_password)s
mysql-server mysql-server/start_on_boot boolean true
""" % {
        "root_password": root_password
    }
    seed_dir = "/var/cache/local/preseeding/"
    seed_file = seed_dir + "mysql-server.seed"

    if file.exists(seed_file):
        return

    with ctx.sudo():
        dir.create(seed_dir, recursive=True)
        file.write(seed_file, seed_config)
        sudo("debconf-set-selections %s" % seed_file)
예제 #8
0
def install():
    already_installed = package.is_installed('nginx')

    if server.version == '10.04':
        package.install_ppa('nginx/stable')
    package.install('nginx')

    if not already_installed:
        site_disable('default')

    www_dir = '/var/www'
    www_owner = 'www-data'
    if not dir.exists(www_dir):
        with ctx.sudo():
            dir.create(www_dir)
            dir.attributes(www_dir, owner=www_owner, group=www_owner)

    restart()
예제 #9
0
def _ensure_layout(owner):
    home_dir = user.home_directory(owner)
    repo_name = git.repository_name()

    join = os.path.join
    project_dir = join(home_dir, repo_name)

    paths = {
        'project':  join(project_dir),
        'current':  join(project_dir, 'current'),
        'releases': join(project_dir, 'releases'), 
        'shared':   join(project_dir, 'shared'),
        'logs':     join(project_dir, 'shared', 'logs'),
        'temp':     join(project_dir, 'shared', 'temp')
    }

    with ctx.sudo(owner):
        for path in paths.itervalues():
            if dir.exists(path): 
                continue
            dir.create(path, recursive=True)

    return paths
예제 #10
0
def test_create_default_attributes(run, exists, attributes):
    run.expects_call().with_args("mkdir  path")
    exists.expects_call().returns(False)
    (attributes.expects_call()
        .with_args("path", mode=None, owner=None, group=None))
    directory.create("path")
예제 #11
0
def test_create_passes_attributes(run, exists, attributes):
    run.expects_call().with_args("mkdir  path")
    exists.expects_call().returns(False)
    (attributes.expects_call().with_args("path", mode="foo", owner="bar", group="baz"))
    directory.create("path", mode="foo", owner="bar", group="baz")
예제 #12
0
def test_create_if_path_exists(run, exists):
    exists.expects_call().with_args("path").returns(True)
    directory.create("path")
예제 #13
0
def test_create_recursive(run, exists):
    exists.expects_call().returns(False)
    run.expects_call().with_args("mkdir -p path")
    directory.create("path", recursive=True)
예제 #14
0
def test_create_defaults(run, exists):
    exists.expects_call().with_args("path").returns(False)
    run.expects_call().with_args("mkdir  path")
    directory.create("path")
예제 #15
0
def test_create_if_path_exists(run, exists):
    exists.expects_call().with_args("path").returns(True)
    directory.create("path")
예제 #16
0
def test_create_passes_attributes(run, exists, attributes):
    run.expects_call().with_args("mkdir  path")
    exists.expects_call().returns(False)
    (attributes.expects_call()
        .with_args("path", mode="foo", owner="bar", group="baz"))
    directory.create("path", mode="foo", owner="bar", group="baz")
예제 #17
0
def test_create_default_attributes(run, exists, attributes):
    run.expects_call().with_args("mkdir  path")
    exists.expects_call().returns(False)
    (attributes.expects_call().with_args("path", mode=None, owner=None, group=None))
    directory.create("path")
예제 #18
0
def test_create_recursive(run, exists):
    exists.expects_call().returns(False)
    run.expects_call().with_args("mkdir -p path")
    directory.create("path", recursive=True)
예제 #19
0
def test_create_defaults(run, exists):
    exists.expects_call().with_args("path").returns(False)
    run.expects_call().with_args("mkdir  path")
    directory.create("path")