def add_upstart(name, content): if name.endswith(".conf"): name = name[:-5] upstart_file = "/etc/init/%s.conf" % name with ctx.sudo(): with ctx.unpatched_state(): file.write(upstart_file, content)
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)
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)
def command(name, command): initd_file = "/etc/init.d/%s" % name upstart_file = "/etc/init/%s.conf" % name if file.exists(upstart_file): cmd = "%s %s" % (command, name) elif file.exists(initd_file): cmd = "%s %s" % (initd_file, command) else: cmd = "false" with ctx.unpatched_state(): core.sudo(cmd)
def put(*args, **kwargs): with _ctx.unpatched_state(): return _put(*args, **kwargs)
def put(*args, **kwargs): with _ctx.unpatched_state(): return _put(*args, **kwargs)