Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 6
0
def site_disable(site):
    with ctx.sudo():
        with ctx.cd('/etc/nginx/sites-enabled'):
            file.remove(site)
            reload()
Esempio n. 7
0
def test_remove_defaults(run):
    run.expects_call().with_args("rm -f  path")
    file.remove("path")
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 11
0
def test_remove_defaults(run):
    run.expects_call().with_args("rm -f  path")
    file.remove("path")