Beispiel #1
0
def _create_network(name, subnet):
    tempfile = file.temp()
    try:
        definition = _NETWORK_TEMPLATE % dict(name=name, subnet=subnet)
        file.write(tempfile, definition)
        core.run("virsh net-define %s" % tempfile)
        core.run("virsh net-autostart %s" % name)
    finally:
        file.remove(tempfile)
Beispiel #2
0
    def _upload(self):
        # TODO Warn if there are local changes
        tmp_tar = git.create_archive(self.revision)

        try:
            core.put(tmp_tar, "deploy.tar.gz")
            core.run("tar -xzf deploy.tar.gz")
            file.remove("deploy.tar.gz")

            with ctx.unpatched_state():
                file.write("VERSION", git.revparse(self.revision))
        finally:
            core.local("rm -rf %s" % tmp_tar)
Beispiel #3
0
    def _upload(self):
        # TODO Warn if there are local changes
        tmp_tar = git.create_archive(self.revision)

        try:
            core.put(tmp_tar, "deploy.tar.gz")
            core.run("tar -xzf deploy.tar.gz")
            file.remove("deploy.tar.gz")

            with ctx.unpatched_state():
                file.write("VERSION", git.revparse(self.revision))
        finally:
            core.local("rm -rf %s" % tmp_tar)
Beispiel #4
0
def _upload(owner, upload_dir, revision):
    tmp_tar = git.create_archive(revision)

    try:
        with ctx.cd(upload_dir):
            with ctx.sudo():
                put(tmp_tar, 'deploy.tar.gz')
                file.attributes('deploy.tar.gz', owner=owner)

            with ctx.sudo(owner):
                run('tar -xzf deploy.tar.gz')
                file.remove('deploy.tar.gz')
                file.write('VERSION', git.revparse(revision))
    finally:
        local('rm -rf %s' % tmp_tar)
Beispiel #5
0
def test_remove_recusrive(run):
    run.expects_call().with_args("rm -f  path")
    file.remove("path", recursive=False)

    run.expects_call().with_args("rm -f -r path")
    file.remove("path", recursive=True)
Beispiel #6
0
def site_disable(site):
    with ctx.sudo():
        with ctx.cd('/etc/nginx/sites-enabled'):
            file.remove(site)
            reload()
Beispiel #7
0
def test_remove_defaults(run):
    run.expects_call().with_args("rm -f  path")
    file.remove("path")
Beispiel #8
0
def test_remove_force(run):
    run.expects_call().with_args("rm   path")
    file.remove("path", force=False)

    run.expects_call().with_args("rm -f  path")
    file.remove("path", force=True)
Beispiel #9
0
def test_remove_force(run):
    run.expects_call().with_args("rm   path")
    file.remove("path", force=False)

    run.expects_call().with_args("rm -f  path")
    file.remove("path", force=True)
Beispiel #10
0
def test_remove_recusrive(run):
    run.expects_call().with_args("rm -f  path")
    file.remove("path", recursive=False)

    run.expects_call().with_args("rm -f -r path")
    file.remove("path", recursive=True)
Beispiel #11
0
def test_remove_defaults(run):
    run.expects_call().with_args("rm -f  path")
    file.remove("path")