diff --git a/deploy/deploy_git.py b/deploy/deploy_git.py index 685edb7..5e68edb 100644 --- a/deploy/deploy_git.py +++ b/deploy/deploy_git.py @@ -8,6 +8,7 @@ import logging import datetime import os import pdb +import shutil define_logger("/data/logs/ops/deploy_git.log") log = logging.getLogger(__name__) @@ -48,7 +49,10 @@ class DeployGit: pre_script = self.infos[0][5] self.tag_name = "{name}{now}".format(name=self.name, now=self.now) pdb.set_trace() - build_cmd = "cd /data/publish/git && git clone {url} && cd {name} && sh {pre_script} && cd .. && tar tar zcvf {tag_name}.tar.gz {name} ".format( + if os.path.isdir('/data/publish/git/'+self.name): + shutil.rmtree('/data/publish/git/'+self.name) + + build_cmd = "cd /data/publish/git && git clone {url} && cd {name} && sh {pre_script} && cd .. && tar zcvf {tag_name}.tar.gz {name} ".format( name=self.name, url=url, tag_name=self.tag_name, pre_script=pre_script) os.system(build_cmd) self.tag_file = "/data/publish/git/"+self.tag_name+'tag.gz'